Jump to content

Error 504 when regenerating thumbnails


Recommended Posts

this is a common problem that happens with most of us wehn you start getting a larg number of products in your prestashop, at first when you ware playing arround it was cool to find out that you can resize all your thumbnails and even change the watermark and click on button and wwwoooaalaah you are done,

the real problem is when you start having larg number of items in your store, probably with multiple images forr each product, the number of original images starts building up very fast , and when you decide it is time to regenerate the thumbnail the script starts by deleting existing thumbnails and attmepts to regenerat them again with the new settings you have (thumbnail size and watermark) , this script does everything in one process so the more products you have the longer this process will take and it may (probably will) time out before telling you what went wrong and not showing you the progress while it is working on regenerating those images , the only thing you can be sure of is that the moment you clicked that regenerate button you lost all your existing thumbnails

2 things you can do to get your thumbnails back
the first option is to change you php.ini and change the timeout setting to give processes more time to finish working before comming back at you with the time-out error
the secound option is to get all the images from your server, and put them on your localhost and regenerat the thumbnails locally then upload them to your server again

this problemm was somehow reduced in the 1.3 prestashop release , in this release the regeneration tool gives you option to select what o regeneate the thumbnil for , s yocan chooe o regeeae oly ctgoreima, or only product images, and hen you choose to reeete the product thumna ou can have the option to iether generate all thumbnail sizes or select one size to regenerate at a time , it is a god step on tright diat least the redused te problem into only 1/5th of the problem , but still if you cant change the php.ini to give your script more time to run before timing out you will end up with time out the more your products database grow

Link to comment
Share on other sites

Hi Thank you so much for your kind reply.

2 things you can do to get your thumbnails back
the first option is to change you php.ini and change the timeout setting to give processes more time to finish working before comming back at you with the time-out error



When I reset all the regeneration items back to the original installation of PS despite the fact that I still get the error my thumbs are back again there like in a fresh installation so it seem the script works only when you have the original configuration of thumbs.

but still if you cant change the php.ini to give your script more time to run before timing out you will end up with time out the more your products database grow



I've modified my php.ini in such a way to allow the script to execute for 240 sec and the server to wait 240 before issuing a timeout, yet nothing changes so...

I wonder if there is a reasonable way to change thumbs with 1.2.5

Thank you so much again!

Link to comment
Share on other sites

  • 4 weeks later...

I also noticed that the regeneration of thumbnails ran out of memory.

I got the PHP message in the server error_log file: PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 11716 bytes) in images.inc.php on line 210, referer: admin1234/index.php?tab=AdminImages&token;=..

So I editted the admin1234/index.php and put this on top to extend memory to 400M but you can try to start with a low limit e.g. 40M. Sometimes PHP really needs a lot of memory to create thumbnails. It's very depending on the originals.

It's also possible to overrule the timeout when the web server is allowing this with the set_time_limit PHP command.

So I put these lines just after the header comment block in admin1234/index.php one line below the first */

ini_set("memory_limit", "400M");
set_time_limit(600);

Link to comment
Share on other sites

Thanks, I've tried following your guidelines and this is what I get

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.



so it seems it's not working as another error comes out.

Fortunately I've done it with a test server.

Thanks

Link to comment
Share on other sites

  • 4 weeks later...
  • 8 months later...
  • 1 year later...
  • 1 year later...

I also noticed that the regeneration of thumbnails ran out of memory.

 

I got the PHP message in the server error_log file: PHP Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 11716 bytes) in images.inc.php on line 210, referer: admin1234/index.php?tab=AdminImages&token;=..

 

So I editted the admin1234/index.php and put this on top to extend memory to 400M but you can try to start with a low limit e.g. 40M. Sometimes PHP really needs a lot of memory to create thumbnails. It's very depending on the originals.

 

It's also possible to overrule the timeout when the web server is allowing this with the set_time_limit PHP command.

 

So I put these lines just after the header comment block in admin1234/index.php one line below the first */

 

ini_set("memory_limit", "400M");
set_time_limit(600);

 

Thank for your solution. It worked. :v :v

Link to comment
Share on other sites

  • 8 months later...

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
×
×
  • Create New...