I’m trying to resize an image using codeigniter’s image lib library. Pretty simple. However, the image isn’t resized and moreover, the function returns true, display_errors() doesn’t show any errors.
Here’s my config that I’m passing to the image lib:
//A file is uploaded using codeigniter's upload library, then:
$imgData = $this->upload->data();
$config['image_library'] = 'GD';
$config['source_image'] = $imgData['full_path'];
$config['new_image'] = $imgData['full_path'];
$config['create_thumb'] = false;
$config['maintain_ratio'] = true;
$config['width'] = $newWidth;
$config['height'] = $newHeight;
A print_r of $config after its been set:
Array
(
[image_library] => GD
[source_image] => C:/wamp/www/uploads/8ddbfb2cce91ee314e1f296355aec8c6.jpg
[new_image] => C:/wamp/www/uploads/8ddbfb2cce91ee314e1f296355aec8c6.jpg
[create_thumb] =>
[maintain_ratio] => 1
[width] => 400
[height] => 350
)
The paths are correct, however the image remains untouched after resizing.
Doing a var_dump on $this->image_lib->display_errors() returns this:
string '' (length=0)
If it makes any difference, the images are being uploaded through Uploadify.
Any ideas on what’s wrong?
Try to set the full path from your document root and not from C.
Try this code:
in this way you don’t need to specify the new_image and it will be overwritten