statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
31 stars 1 forks source link

Statamic image handling/manipulation #300

Open mmodler opened 3 years ago

mmodler commented 3 years ago

Hello gentleman, atm we dig into image handling/manipulation a little deeper and i want to ask/discuss some topics:

  1. If we use asset cache and presets, we will run into problems:

    • Waste of disc space: I upload a product image and all presets will be generated, also the presets i will never use with this image (for example the logo_desktop preset)
    • Images are generated synchronously, with many of them you will run into php runtime limits
  2. If we use asset cache without presets:

    • Glide Tag: Images are generated synchronously on url generation (!), not if the image url is requested (BUG?) - which might cause long loading times if image is not cached and runtime limit problems (many images on a page with empty cache)
    • Does the image invalidates if the asset is removed in the cp? (for example ex-employee wants an image to be removed from the web)
  3. Assets cache off:

    • Every request for an image will be handled via php - performance/resource problems if traffic increases
    • Invalidation issue would presits, as glide caches under storage/statamic/glide ?

In our former cms we had the following concept:

Atm i have no idea how to use statamic image handling right - or i just misunderstood some concepts?

RyanThompson commented 3 years ago

Ya, our method had it’s drawbacks too though. Modifications are detached from any system knowledge for one. Craft is an example of someone who does some things right here that’s a mix between two approaches, which is similar In some ways to our new approach in Streams 2. Still fleshing it out. Craft’s performance takes a nose dive however, the more you utilize file variants last I checked. Less of an issue with flat-file DB perhaps.

jeremydouglas commented 3 years ago

This is a great list of insights and opportunities to improve asset processing. I opened a new issue that would address the specific presets.

mmodler commented 3 years ago

Some design decisions are necessary for an implementation / PR. I'll call the new asset cache method "cache on request"

jesseleite commented 2 years ago

Most of this is addressed by https://github.com/statamic/cms/pull/6040, which should be coming soon 👍