Jump to content

[SOLVED] Images broken after resize


toni
 Share

Recommended Posts

Hi,

I'm facing a strang problem. In my template I'm setting different sizes for srcset:

$view->set('images', $page->picture);
<img srcset="{$img->size(780,0)->url} 780w, {$img->size(1024,0)->url} 1024w, {$img->size(1440,0)->url} 1440w" src="{$img->url}" class="col__image">

All fine. However, the moment I reorder images in backend the different generated image sizes are broken.
Does somebody has an idea what could cause it? 

Version: ProcessWire 3.0.123 
 

Thanks!

Toni

Edited by horst
changed the title to [SOLVED] ...
Link to comment
Share on other sites

35 minutes ago, toni said:

the moment I reorder images in backend

That's weird. Re-ordering images shouldn't do anything besides.... re-ordering and nothing else.

17 minutes ago, toni said:

his is what a broken image looks like

I don't get it. Is that text (This is intentionally invalid image data) displayed in the browser? 

Look in the page's asset folder. Are all your images still there? Also, check server- and PW error logs, and your browser JS console for suspicious stuff.

  • Like 1
Link to comment
Share on other sites

2 hours ago, toni said:

In Addition, this is what a broken image looks like:
 


$ cat /Users/base/Desktop/cmueller_dasstillebildverlassen4.780x0.jpg 

This is intentionally invalid image data.

 

This is how Pageimage handles errors that occur while trying to create variations. You can view the relevant parts of the code here.

I'm not entirely sure if the error is visible while logged in as superuser, but one option would be enabling debug mode via $config->debug in /site/config.php – this way it should be saved into the image-sizer log file in /site/assets/logs/. Note that you don't want to enable debug mode if this is a live site, though. Optionally if you know when the error is going to occur, you can manually output the $img->error property after the size() call ?

There are a few reasons why this can happen, so the first thing would definitely be checking that error message.

Link to comment
Share on other sites

@toni Very often it has to do with not enough memory for loading the source image into ram and create the variation(s). Check PHPs max_memory and if possible, use the imagick image rendering engine, as it can process images in chunks or lines, whereas the GD library always need to load the complete uncompressed image into ram.

Link to comment
Share on other sites

Hey ho!

Sorry for late reply. All answers helped a lot! By knowing where to find the image sizer logs I could see that memory exceeded as horst suspected.
I've tried the imagemagick module before but even if I checked everything I could it did not seem to work. Just before asking for help here and with my hoster. I found the mistake with rubber duck debugging ;))

-> The images where already generated (broken), so processwire did serve the broken images. After getting rid of them, the imagemagick module does a wonderful and ligthing fast job by recreating them.

All fine! grazie mille!

Toni

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...