-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Last commit (WPML fix) broke the result when there is no image #91
Comments
I would not consider your solution adequate in the case of $upscale being true. 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. 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 ) );
The text was updated successfully, but these errors were encountered: