Jump to content

Modifying image output in template files


Recommended Posts

I'm attempting to leverage a service like imgix in order to compress and format images as `webp` when possible.

It works great for the most part, but the problem is that Prestashop generates (and saves) multiple versions of an image. Since services like imgix bill per filename, this is causing the cost to skyrocket for us.

I need to modify the template so that, instead of saving several filename variations, it appends a parameter to a single master image. For example:

  • img.jpg?w=300 (thumbnail)
  • img.jpg?w=600 (medium)
  • img.jpg?w=1600 (large)
  • etc

I've tried looking at the .php templates but I'm not finding an easy way of changing the image output. Does anyone know which function or template to edit?

Skärmavbild 2020-01-07 kl. 09.24.53.png

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...
On 12/21/2021 at 3:44 AM, Knowband Plugins said:

As per our understanding you are using a module to create a compress image and we suggest you to contact the module developer about the same.

Thanks for the reply, though I'm not using a Prestashop module.

I want to know how to edit the Prestashop template to modify the different image variation URLs. Ex, instead of using `10375-small_default_2x.jpg` in the screenshot, I want to use `10375.jpg?w=200` instead.

Link to comment
Share on other sites

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...