Jump to content

Fatal error: Call to undefined method


bugzy

Recommended Posts

I'm trying to resize an image on upload

 

Here's the function

 

<?php

class SimpleImage {

   var $image;
   var $image_type;

function me_resize($width,$height) {
$new_image = imagecreatetruecolor($width, $height);
if( $this->image_type == IMAGETYPE_GIF || $this->image_type == IMAGETYPE_PNG ) {
	$current_transparent = imagecolortransparent($this->image);
	if($current_transparent != -1) {
		$transparent_color = imagecolorsforindex($this->image, $current_transparent);
		$current_transparent = imagecolorallocate($new_image, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue']);
		imagefill($new_image, 0, 0, $current_transparent);
		imagecolortransparent($new_image, $current_transparent);
	} elseif( $this->image_type == IMAGETYPE_PNG) {
		imagealphablending($new_image, false);
		$color = imagecolorallocatealpha($new_image, 0, 0, 0, 127);
		imagefill($new_image, 0, 0, $color);
		imagesavealpha($new_image, true);
	}
}
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->image = $new_image;	
}
}

?>

 

 

and I'm calling it like this

 

 

<?php  $image = new SimpleImage();
  	 $image->load($_FILES['uploaded_image']['tmp_name']);
  	 $image->me_resize(250,400);
   	 $image->save($_FILES['uploaded_image']['tmp_name']); ?>

 

 

and I'm getting this error

 

Fatal error: Call to undefined method SimpleImage::load() in C:\wamp\www\runa\admin\add_item.php on line 48

 

 

Any idea guys?  :shrug:

Link to comment
https://forums.phpfreaks.com/topic/266257-fatal-error-call-to-undefined-method/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.