Contao extension to provide the possibility of defining alternative images to be used on different output devices.

Overview

Contao Image Alternatives

This extensions expands the capabilities of using responsive images with art direction in Contao. You will have the possibility to define a set of alternatives which will then allow you to define the respective alternatives per image in the file manager.

Suppose you want to use different images for a certain image size depending on the output device, i.e. a specific image for desktop, for tablets and for mobile. You can define a set of alternatives called mobile and tablet for example (desktop will be the fallback - the original image):

# config/config.yaml
contao_image_alternatives:
    alternatives:
        - tablet
        - mobile

Now you can choose the alternatives for each image separately in Contao's file manager:

The back end labels for each alternative can be translated via the image_alternatives translation domain:

# translations/image_alternatives.en.yaml
tablet: Tablet
mobile: Mobile

Within your image size settings you can then choose per media query item, whether an alternative image should be chosen for this particular image size:

Alternatively you can also set the alternative in your config via contao_image_alternatives.sizes.*.items. Note that the name of the size must be same name as in contao.image.sizes and the media query for each item must match with the ones in contao.image.sizes.*.items:

# config/config.yaml
contao_image_alternatives:
    alternatives:
        - tablet
        - mobile
    sizes:
        example:
            items:
                -
                    media: '(max-width: 480px)'
                    alternative: mobile
                -
                    media: '(max-width: 800px)'
                    alternative: tablet

When you choose the configured image size in your content element or module, the generated images will automatically use the alternative versions for each source image for the particular image size media query item.

You might also like...
The Tinify API allows you to compress and optimize WebP, JPEG and PNG images.

The Tinify API allows you to compress and optimize WebP, JPEG and PNG images. It is designed as a REST service. The client libraries in various languages make it very easy to interact with the Tinify API.

Simple, fast and secure archive for images
Simple, fast and secure archive for images

Slim Image Archive Simple*, fast and secure archive for images: Create multiple categories with multiple albums with multiple images! Manage multiple

The image server plugin allows you to add responsive images via config without extra elements

Grav image server plugin adds picture tag with loading, responsive, high density images

Create beautiful generative background images from a string. Based on jasonlong/geo_pattern

GeoPattern This is a PHP port of jasonlong/geo_pattern. Generate beautiful tiling SVG patterns from a string. The string is converted into a SHA and a

⚡ Dynamically generated, customizable SVG that gives the appearance of typing and deleting text. Typing SVGs can be used as a bio on your Github profile readme or repository.
⚡ Dynamically generated, customizable SVG that gives the appearance of typing and deleting text. Typing SVGs can be used as a bio on your Github profile readme or repository.

⚡ Dynamically generated, customizable SVG that gives the appearance of typing and deleting text. Typing SVGs can be used as a bio on your Github profile readme or repository.

PHP library to easily edit image with GD extension. Resize, crop, merge, draw, and many more options !
PHP library to easily edit image with GD extension. Resize, crop, merge, draw, and many more options !

PHP Image Editor PHP library to easily edit image with GD extension. Resize, crop, merge, draw, and many more options ! ✨ Supporting ⭐ Star this repos

Image manager extension for the Yii PHP framework.

yii-imagemanager Image manager extension for the Yii PHP framework. Introduction I started this project to reduce the need for boilerplate code when w

Contao extension to provide content templates for pages.

Contao Content Templates In Contao, the regular content of a page can be made up of different articles, each assigned to different sections of a page

BicBucStriim streams books, digital books. It fills a gap in the functionality of current NAS devices that provide access to music, videos and photos

BicBucStriim streams books, digital books. It fills a gap in the functionality of current NAS devices that provide access to music, videos and photos -- but not books. BicBucStriim fills this gap and provides web-based access to your e-book collection.

TYPO3 CMS extension which checks used CSS selectors in HTML output of the current page and removes CSS declarations which are unused.

EXT:css_coverage TYPO3 CMS extension which checks used CSS selectors in HTML output of the current page and removes CSS declarations which are unused.

A Laravel package to output a specific sql to your favourite debugging tool. The supported log output is Laravel Telescope, Laravel Log, Ray, Clockwork, Laravel Debugbar and your browser.
A Laravel package to output a specific sql to your favourite debugging tool. The supported log output is Laravel Telescope, Laravel Log, Ray, Clockwork, Laravel Debugbar and your browser.

Laravel showsql A Laravel package to output a specific sql to your favourite debugging tool, your browser or your log file. Use case You often want to

Enables the possibility generating sanitized URL parts from persisted patterns.

#Persisted sanitized pattern mapping What does it do? Enables the possibility generating sanitized URL parts from persisted patterns. How does it work

The objective of this project is to manage The Website Manga, this site permits to Client to show, read and download Manga with the possibility to react, vote, and save his data.
The objective of this project is to manage The Website Manga, this site permits to Client to show, read and download Manga with the possibility to react, vote, and save his data.

The objective of this project is to manage The Website Manga, this site permits to Client to show, read and download Manga with the possibility to react, vote, and save his data.

A package for defining scoped styles in Livewire components

A package for defining scoped styles in Livewire components

This extension expands WSOAuth extension and provide a EveOnline SSO login method

This extension expands WSOAuth extension and provide a EveOnline SSO login method

This project uses dflydev/dot-access-data to provide simple output filtering for cli applications.

FilterViaDotAccessData This project uses dflydev/dot-access-data to provide simple output filtering for applications built with annotated-command / Ro

Contao Open Source CMS

About Contao is a powerful open source CMS that allows you to create professional websites and scalable web applications. Visit the project website fo

The news bundle adds news functionality to Contao 4

Contao 4 news bundle The news bundle adds news functionality to Contao 4. Contao is an Open Source PHP Content Management System for people who want a

Releases(1.1.0)
Owner
inspiredminds
inspiredminds
Alternative image provider for fakerphp using picsum.photos

Fakerphp Picsum Images Introduction Alternative image provider for fakerphp using picsum.photos This package has been forked from mmo/faker-images for

Arnaud Becher 16 Dec 9, 2022
ImageWorkshop is a PHP5.3+ library that helps you to manage images based on GD library

================================ ImageWorkshop class ================================ Summary and features Really flexible and easy-to-use PHP class t

Clément Guillemain 853 Dec 27, 2022
GifCreator is a PHP class that creates animated GIF from multiple images

================================ GifCreator ================================ GifCreator is a PHP class to create animated GIF from multiple images For

Clément Guillemain 320 Dec 15, 2022
Create images with embedded text using advanced typography

Image with Text This class makes it super easy to render images with multiple, independently styled text blocks. You can control each text block's ali

New Media Campaigns 144 Sep 7, 2022
Easily convert images with Glide

Easily convert images with Glide This package provides an easy to use class to manipulate images. Under the hood it leverages Glide to perform the man

Spatie 374 Dec 30, 2022
A PHP GD + TwitterOAuth demo to dynamically generate Twitter header images and upload them via the API.

A PHP GD + TwitterOAuth demo to dynamically generate Twitter header images and upload them via the API. This enables you to build cool little tricks, like showing your latest followers or sponsors, latest content creted, a qrcode to something, a progress bar for some goal, and whathever you can think of.

Erika Heidi 172 Jan 5, 2023
Optimize your images on the fly with Glide for Laravel.

Glide for Laravel Optimize your images on the fly with Glide for Laravel. Support us Like our work? You can support us by purchasing one of our produc

Flowframe 53 Oct 17, 2022
Upload SVG images in Magento 2.x

Upload SVG images in Magento 2.x This extension for Magento 2 allows uploading SVG images in the following sections: wysiwyg editor in static blocks a

Magegadgets 6 Dec 23, 2022
PHP library to resize, scale and crop images.

PHP library to resize, scale and crop images.

Gumlet 1.1k Jan 3, 2023
Inline Images Protocol implementation for PHP.

Imgecho Echo the image on iTerm App using Inline Images Protocol. Installation Use Composer to install. composer require mileschou/imgecho Usage Use

MilesChou 4 May 30, 2022