smart_resize_image
smart_resize_image copied to clipboard
PHP 5.1.6 w/ GD 2.0.28 does not like NULL 2nd param to imagejpeg
I get an error when the second parameter passed to imagejpeg is NULL.
Unable to open '' for writing in ...
I worked around the issue by changing the switch statement at the bottom:
{
Writing image according to type to the output destination
switch ( $info[2] ) { case IMAGETYPE_GIF: ($output == NULL) ? imagegif($image_resized) : imagegif($image_resized, $output); break; case IMAGETYPE_JPEG: ($output == NULL) ? imagejpeg($image_resized) : imagejpeg($image_resized, $output); break; case IMAGETYPE_PNG: ($output == NULL) ? imagepng($image_resized) : imagepng($image_resized, $output); break; default: return false; } }