Welcome Guest, Not a member yet? Register   Sign In
CI_Image_lib::image_save_gd() -- always returns TRUE regardless

This function always returns TRUE whether or not it was able to save the image. Since the internal calls to imagegif(), imagejpg() and imagepng() are silenced in this function, no error is displayed. Then the function defaults to returning TRUE at the end of its call, so the function that called it has no idea that it wasn't able to do its job.

How to reproduce:
Attempt to resize an image to a non-existent folder. The resize() operation will pass with flying colors, but no resized image will be found.

Possible solutions:

1. Validate that the destination path is writeable before calling this function.
2. Return FALSE from this function and handle that in the calling code.

Note: this is not a function called directly from outside of the Image_lib. It's called internally, so the only way for a user of the library to fix it would be subclass the Image_lib class and put the fix in the subclass. The permanent fix needs to be part of a CodeIgniter update.

Theme © iAndrew 2016 - Forum software by © MyBB