Zdjęcie niedostępne

Image Optimizer

Image optimizer module is an easy way to resize and compress images on the fly. Use responsive images with size alternatives.

Developed by Pixel Open

Get This Module Free on GitHub
PS 1.7 – 9.x License: MIT Status: Active Health: Excellent

Info updated 1 month ago

Sources
Stars: 8 Last commit: Apr 11, 2025
Type
Module

Info checked: Mar 2, 2026

Prestashop Image Optimizer

Presentation

Image optimizer module is an easy way to resize and compress images on the fly. Use responsive images with size alternatives.

Requirements

  • Prestashop >= 1.7.6.0
  • PHP >= 7.2.0

Installation

Download the pixel_image_optimizer.zip file from the last release assets.

Admin

Go to the admin module catalog section and click Upload a module. Select the downloaded zip file.

Manually

Move the downloaded file in the Prestashop modules directory and unzip the archive. Go to the admin module catalog section and search for "Image Optimizer".

Widget

{widget name='pixel_image_optimizer'}

Options

The image to optimize
  • id_image: the prestashop image id (ex: 1)
{widget name='pixel_image_optimizer' id_image=1}
  • image_path: the image path (ex: img/cms/image.jpg)
{widget name='pixel_image_optimizer' image_path='img/cms/image.jpg'}
Optimizer options
  • alt: alternative text (optional)
  • class: img element class name (optional)
  • image_name: image name (optional, keep the same image name if empty)
  • quality: image quality from 0 to 100 (optional, used only for jpg and webp)
  • width: maximum width (optional)
  • height: maximum height (optional)
  • ext: convert image to jpg, png, gif or webp (optional)
  • breakpoints: Alternative widths of responsive images in px (e.g. "500,800,1200") (optional)
  • template: custom template file

Examples

Product image
{foreach $product.images as $image}

{widget name='pixel_image_optimizer' id_image=$image.id_image image_name=$product.name alt=$image.legend class="product-image" quality=80 width=750 } {/foreach}

Result:

<img src="https://www.example.com/img/web/my-product-name-750x562-80.jpg"

alt=&quot;Legend&quot; class=&quot;product-image&quot; width=&quot;750&quot; height=&quot;562&quot; loading=&quot;lazy&quot; /&gt;

Simple image
{widget name='pixel_image_optimizer'

image_path=&#039;img/cms/image.jpg&#039; quality=90 height=600 }

Result:

<img src="https://www.example.com/img/web/image-800x600-90.jpg"

width=&quot;800&quot; height=&quot;600&quot; loading=&quot;lazy&quot; /&gt;

Responsive image
{widget name='pixel_image_optimizer'

image_path=&#039;img/cms/image.jpg&#039; quality=90 width=1200 breakpoints=&#039;500,800&#039; }

Result:

<picture>

&lt;source media=&quot;(max-width: 800px)&quot; srcset=&quot;https://www.example.com/img/web/image-800x400-90.jpg&quot; /&gt; &lt;source media=&quot;(max-width: 500px)&quot; srcset=&quot;https://www.example.com/img/web/image-500x250-90.jpg&quot; /&gt; &lt;img src=&quot;https://www.example.com/img/web/image-1200x600-90.jpg&quot; loading=&quot;lazy&quot; /&gt; &lt;/picture&gt;

Custom template

You can create your own template to display image.

Create a new template file in the pixel_image_optimizer directory for your theme:

themes/{themeName}/modules/pixel_image_optimizer/custom.tpl

Add the template option in the widget with the template path:

{widget name='pixel_image_optimizer'

image_path=&#039;img/cms/image.jpg&#039; width=1200 template=&#039;module:pixel_image_optimizer/custom.tpl&#039; }

Clear image cache

Manually remove the <code>img/web</code> directory content, or use the Clear Image Cache button from admin:

Advanced Parameters > Performance > Clear Image Cache

  • Indeks
    pixel_image_optimizer

  • License
    MIT
  • PS Compatibility
    1.7.x
    8.x
    9.x
  • Status
    Active

Komentarze (0)

Na razie nie dodano żadnej recenzji.
Ładowanie...