elgentos / magento2-imgix

Imgix extension for Magento 2 - automatically optimize your images
16 stars 7 forks source link

Leverage new Magento 2.4 functionality? #9

Open peterjaap opened 3 years ago

peterjaap commented 3 years ago

Opmerkingen van Barry;

Uit interesse mbt die Imgix module, had je deze commit gezien? https://github.com/magento/magento2/commit/41b1cd54488dd6709124d618f1c570e9d0eab51a Als je de URL optie op ‘dynamic hash’ zet dan vervangt ie dus de URL door de originele file + width/height in de parameters (en schakelt hij resizen uit). Met een Plugin afterGetUrl() op die Asset/Image class, zou je volgens mij gewoon de URL moeten kunnen overschrijven en heb je toegang tot de gewenste width/height (uit de URL danwel via die Image class). Dan heb je niet al die observers om de image urls te vervangen nodig toch? En dan heb je ook al direct de width/height etc. Of is dat bewust zo gedaan (in 2.3 zat dit ook nog niet volgens mij)

Zoiets dus; https://github.com/barryvdh/magento2-custom-image-url

ArjenMiedema commented 3 years ago

@peterjaap just did a try with setting the default Magento value for "Base URL for User Media Files" to the URL of Imgix and that shows the correct image, without any other settings. It only requires the Imgix specific parameters like fit, fill-color, compress, etc. That could be done within this module to send that along as parameters to Imgix.

barryvdh commented 3 years ago

Ah I see that Imgix supports both the w=.. as well as width=.. so you don't even need to rewrite the parameters in that case :) But yeah if you want extra parameters or secure the URL, you could just use the Plugin afterGetUrl()

barryvdh commented 3 years ago

And besides the benefit of not having to generate resized images on the server, it will also use the original image as base instead of the cached images. So only 1 image will count to as 'Master Image' per product image, instead of all different sizes counting as different master images.

jesse-deboer commented 1 year ago

We just did a 'temporary' update that automatically gets the right image size for now https://github.com/elgentos/magento2-imgix/releases/tag/2.0

We will look into implementing the above way for the next release!