Jump to content
OLSA

Solved: ImageSizer::resize failed

Recommended Posts

Hello for all.

I have strange problem with images in PW 3.0.62, wamp, PHP 5.6 - 7.0.23, (Windows 10, i5, 8GB RAM).

1. Can't upload some images, process failed in first step (thumbnail preview creation).

2. Images can be uploaded/saved using API, but later in admin backend, there is no preview thumbnail image. It can be opened and zoom, but can't edit/crop/resize .

3. Everything works fine in PHP 7.1.9

Warning and errors:
"Warning: filesize(): stat failed for .../site/assets/files/image-name.jpg in ...\wire\core\Pageimage.php on line 511"
"ImageSizer::resize(0, 260) failed"
"ProcessPageEditImageSelect: Unable to complete resize"

I have large number of images with that problem in current project, and if someone want to test this, I attached two "bad" images, and screenshot from admin backend.

Don't know is this some kind of ProcessWire issue or there is some problem with images?

Please, what is yours opinion about this?

Thanks.

 

bad-image-1.jpgbad-image-2.jpgScreenshot-1.png

Share this post


Link to post
Share on other sites

After all, write small function to locally test resizing of images (using default PHP GD image library) and find that this images are not 100% valid (semi corrupted jpeg files).

Strange thing was, as you can see here (first two images) looks normal. Same PW on Windows with PHP >=7.1.9 works fine - no problems with upload and resize.

Inside PW logs, Tracy debugger, Wamp/PHP logs, custom core debugging, didn't find any exception/note about "Corrupt JPEG data" (maybe because error suppression operator (@) in few places inside image processing/pw core). Also playing locally with PHP getimagesize() return correct image data (size, bit, channels, mime...) for all that images . Etc...

If you ever had a problem with upload/resize images, and on server use PHP GD enginee, and images looks ok, maybe there is a problem with small file corruption. In that case you can try to put this in site/config.php

ini_set("gd.jpeg_ignore_warning", 1);

This will not fix corrupted jpeg image, but will provide that PW image processing do job and doesn't break.

Regards.

Share this post


Link to post
Share on other sites

I'm having the same problem with uploading images. The images are small 640x640, around 220KB, the upload correctly, but then something goes wrong in the image preview/thumbnail correction, and  I get an error, where the preview is not a recognized image. I'm using php 7.3.1 on MAMP 5.3, and Processwire 3.0.135.  OLSA's solution doesn't work. Is something else happening?

 

 

Screen Shot 2019-07-18 at 2.03.12 PM.png

Share this post


Link to post
Share on other sites

Can you may use the IMagick-Engine instead of GD, just for testing? You can enable it under modules > core > image, if your server supports it.

Share this post


Link to post
Share on other sites

Thanks horst for the reply, but alas, there doesn't seem to be Imagick installed on the server. Any other workarounds?

Share this post


Link to post
Share on other sites

I know this thread is marked as solved - but I wanted to make a few comments.

On 1/17/2018 at 7:05 PM, OLSA said:

maybe because error suppression operator (@) in few places inside image processing/pw core)

@OLSA FWIW, Tracy Debugger has a scream mode that forces it to ignore the @ supression. Just enable it in the settings page if needed.

@demhan If you are using GD, then I think it counts towards your process' memory limit. Try upping the max memory limit for PHP and see if that helps. (Link if needed)

  • Like 1

Share this post


Link to post
Share on other sites

I set the memory_limit to 256M (ini_get('memory_limit') confirms it). But the problem persists ...

Is there any way to debug this? I've set config->debug to true.

This is the only error message I get (logs/imager-size.txt & logs/exceptions.txt):

2019-07-19 12:23:47    pwadmin   http://localhost:8888/pw/page/edit/?id=1038&InputfieldFileAjax=1  /site/assets/files/1038/natures_seat1_small.0x260.jpeg - natures_seat1_small.0x260.jpeg - not a recognized image

Share this post


Link to post
Share on other sites

I still haven't figured this. On further experimentation I have managed to get another image uploading correctly (but not the one I wanted). Both are jpegs, both are around 130K, and one gives and error and the other doesn't. Preview (osx) opens both correctly. I'm attaching screenshot with both images ...

 

Anyone have some insight into this? It's driving me crazy!

Screen Shot 2019-07-20 at 7.17.43 PM.png

Share this post


Link to post
Share on other sites
On 7/19/2019 at 6:07 AM, demhan said:

I get an error, where the preview is not a recognized image

I suspect the image is corrupt in some way, or maybe contains some metadata, colour profile, etc, that can't be handled. Try opening this image in Photoshop or similar and then save it as a new JPG, making sure to use the standard sRGB colour profile.

Share this post


Link to post
Share on other sites

I did test it with a new image using preview, no change. Anyway, the picture is uploaded correctly--the website even displays it correctly. What is failing is the thumbnail that processwire is creating for its admin pages.

Share this post


Link to post
Share on other sites

I'm seeing the same problem on my install.  I'm not sure when it was introduced. I'm running the latest version of Processwire. 3.0.135

Here is the error I get in the console:

JqueryUI.js?v=1563290320:7 Uncaught TypeError: Cannot read property 'addClass' of undefined
    at e.<computed>.<computed>._mouseCapture (JqueryUI.js?v=1563290320:7)
    at e.<computed>.<computed>._mouseCapture (JqueryUI.js?v=1563290320:6)
    at e.<computed>.<computed>._mouseDown (JqueryUI.js?v=1563290320:6)
    at e.<computed>.<computed>._mouseDown (JqueryUI.js?v=1563290320:6)
    at HTMLSpanElement.<anonymous> (JqueryUI.js?v=1563290320:6)
    at HTMLSpanElement.dispatch (JqueryCore.js?v=1563290320:2)
    at HTMLSpanElement.u (JqueryCore.js?v=1563290320:2)

In my case I have an image field inside a repeater.  I drag the image into the field to upload the file.  It uploads, but it doesn't generate an proper thumbnail. At this point I don't see any errors in the console or Tracy debugger.  Then if I try to use the thumbnail image resize slider it throws the error in the console.

Maybe someone else can my steps to reproduce the same error?

Share this post


Link to post
Share on other sites

Okay, after more investigating I can only reproduce this on image fields inside a repeater that have been set to "Vertical list (verbose)".  To be clear it doesn't happen on normal image fields, only those inside a repeater.

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...