Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aeyoll/image-retriever-for-prestashop

This module helps you generate thumbnails and webp/avif alternatives for images inside a custom module.
https://github.com/aeyoll/image-retriever-for-prestashop

Last synced: about 2 months ago
JSON representation

This module helps you generate thumbnails and webp/avif alternatives for images inside a custom module.

Awesome Lists containing this project

README

        

# Image Retriever for PrestaShop

This module helps you generate thumbnails and webp/avif alternatives for images inside a custom module.

Requirements
---

PHP 7.1+ is needed to use this module.

Installation
---

### PrestaShop 8.0+

For PrestaShop 8.0+, require the plugin with Composer using the following command:

```sh
composer require aeyoll/image_retriever
```

Usage
---

Let's assume you have an image file in a module, located at `modules/your_module/img/test.jpg`.

```php
getImage(
_PS_MODULE_DIR_ . 'your_module/img/', // The absolute path to the uploaded images folder
'test.jpg', // The image filename
['home_default'] // Optional: generate only specific image types, otherwise generate every format
);
```

In your template:

```tpl

{if !empty($image.bySize.home_default.sources.avif)}

{/if}

{if !empty($image.bySize.home_default.sources.webp)}

{/if}