CodeIgniter Forums

Full Version: Bug with Image_lib.php - images with new_image set with full path produce bad dest path
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Sorry, poorly written subject. This is the problem:

Quote:This looks like a bug in Image_lib.php (v1.7.1)

The documentation says you can enter a full path and file name for the config option “new_image”.

In my case Image_lib.php is failing on line 1216 where imagejpeg() is trying to use the value of $full_dst_path. Where my values fed into the resize method were for example:

$config[‘source_image’] = “path/to/source/image/source_name.jpg”;
$config[‘new_image’] = “different/path/to/new/image/new_name.jpg

The value of $full_dst_path was being put together (on line 264) as


using the following:

$this->full_dst_path = $this->dest_folder.$filename.$this->thumb_marker.$file_ext;

El Forum

This is mostly invalid. I have found the problem in my case, my new filenames did not include the file extensions (they are generated from the original file name plus a timestamp, and as a left-over from an old script, did not have the extensions reattached to the name). Image_lib.php was assuming the value of new_image was a directory, despite the lack of a trailing slash.