Open rubenbristian opened 7 years ago
I would not consider your solution adequate in the case of $upscale being true. Also in case of $single being false the $width and $height returned in your example would not match the returned images dimensions, not sure if this is desired?
image_resize_dimensions will return false if $crop is false and the original image dimensions are less than those requested, no matter the value of $upscale. In this case aq_resize currently returns an empty result, and might even throw a PHP warning(?).
Aq_resize should either return an upscaled image or the original image.
Also a little more helpful error would be great. Just had an image that was not resizing because it was simply to small. Took me a while to understand that the image was simply to small.
@Jontis00 How do we resolve this error? I am experiencing this error currently.
@arawls-csu Have you tried version 1.2.2? Sounds like e00a662 tried to solve this issue, but I have not tested it myself.
Hi
In last commit you've removed the $result variable, which actually made sure that you get an image if the resize fails.. The fail can be caused by multiple reasons, even if the image exists. So now, if there is no resize, you get an empty string. This is obvious an error, which previously worked well..
Please return the $result variable.. Instead of a simple return it should be like this:
$result = $aq_resize->process( $url, $width, $height, $crop, $single, $upscale ); return $result !== false ? $result : $url;
Actually, this still breaks if the user requests an array. Because if he does, most probably he'll check for something like $resized_img[0], which will return the first letter of the string. So, a better solution would be something like this for the last line:
return $result !== false ? $result : ( $single ? $url : array( $url, $width, $height ) );