getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.55k stars 1.41k forks source link

Responsive images (derivatives) generation on image upload or via option in the admin backend #2918

Open HoloBack opened 4 years ago

HoloBack commented 4 years ago

Currently, in the latest version of GRAV the image derivatives are generated on the first page request, which can take a lot of processing time. Are you working on a feature to generate the images on upload (f.e. according to admin settings) or through a button "Generate responsive images" in the backend? This would be a very important feature.

I tried some plugins which should solve this problem, but none of them worked for me.

ricardo118 commented 4 years ago

@HoloBack if you hit preview in admin, would that technically do first page request? essentially generating the images?

HoloBack commented 4 years ago

@ricardo118 Thanks for the fast reply! Yes it does the first page request, but it doesn't solve the problem - you just click through all the pages manually in preview mode. I think it would save a lot of time, if images would be generated on upload and additionally with a button "Generate images", where a background process is started which iterates through every page and generates the images. That's how we all know it from Wordpress and other CMS.

arkhi commented 3 years ago

I would love this feature too. Generating derivatives for each image on upload would be less intensive and hopefully avoid server timeout in the case of a lot of images with derivatives on one page.

kali-hernandez commented 3 years ago

How does it behave in this first page request scenario, if there are concurrent first page requests? Would it trigger a race condition? That would be a much more important reason to have the generation run in the background on upload rather than on page display

HoloBack commented 3 years ago

@arkhi You're right, currently we are using the Warm Cache plugin which does a good job, but sometimes crashes with a 500 when processing to many images. I think processing them on upload like f.e. Wordpress does, is a good approach.

Good point @kali-hernandez, that's an interesting scenario too.