Image processing should not interrupt the user request-response
Closed this issue · 6 comments
This is a useful extension but I feel the method of optimising images "on the fly" is inherently flawed because it interrupts the user request-response cycle. On a category page with 50 product images to optimise this means the user will have to wait a potentially very long time (multiple minutes) or, depending on server configuration, they will suffer a 503 server error as the request times out.
Can we fix this by (optionally) optimising the images using a cron job instead? I see the optimisation appears to be done via a helper method so perhaps some basic script that iterates every product and optimises the images in the background would be beneficial?
Has this been tackled before? I can't be the first person to recognise this issue!
Hi @bluec ,
Thanks for your message. Being able to use crons would be a great addition to the extension. But currently there is no such feature. What I will do is discuss this with my colleagues (and TinyPNG) and come back to you with a response if this is something we want to add.
Kind regards,
Jasper
Thanks @tig-jaspersmits I may need to add this myself so I'll fork and you can have a PR if you like what I come up with.
Hi guys
I would absolutely love this feature, this concept is great, but currently, it kills the frontend user experience due to the on-the-fly nature. @bluec if you have implemented this, can I please have more information 👍
Hi @pearcestephens I did quickly look into this but I vaguely recall I could not find an easy solution because of the way this extension is implemented. Because our usage was very limited and quite a small catalogue it wasn't worth my time to implement the cron feature for now. Let me know if you have any joy with it.
Hi @bluec ,
This is a very late response, but we decided to don't look further into this. It did require a lot of work and changes to the extension. The focus is currently on the TinyCDN Magento 2 extension.
Sorry again for the delayed response, I hope you understand why we made this choice. If you have any further questions please let me know.
Kind regards,
Jasper
TIG