Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Image::resize .png image

edited September 2018 in Framework

If I don't add 'ext' for the $format variable when I call Image::resize(), the function tries to convert the .png to a .jpg and gets an '#exception-caught' error.


$resized_image = Image::resize ($tmp_file, 404, 539, 'contain', 'ext'); -- works fine. $resized_image = Image::resize ($tmp_file, 404, 539, 'contain'); -- returns image with '#exception-caught' if the image is a .png.


  • That method isn't for converting between formats, just for resizing the image. But the default value for $format was jpg which is what caused the issue with .png images.

    I just pushed a change to make the default ext which I think is a smarter default anyway and should continue to work the same for .jpg images anyway.

  • I wasn't trying to convert formats. Image::resize () was converting the .png images to .jpgs but saving them with .png extensions.

  • Ah, I see what you mean.

    I think the ext change should improve things, but I'll have to test other variations so it converts and saves under the right extension in all cases.

Sign In or Register to comment.