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

Overview

Image server plugin

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

Features

  • WebP Images
  • Lazy loading via attribute
  • Responsive images
  • Retina images in different quality levels
  • Adds width and height
  • Add default class (often needed for responsive images)
  • Configure sets
    • Allows adding different breakpoints and max width per set
    • Add a ratio e.g. header or teaser image
    • Overwrite loading and class
    • Used via parameter or twig/template
  • Works in Page Content (Markdown), templates (via twig or helper template)
  • All that is helpful for faster websites especially on mobile

Example/Demo

Frontend only - Includes different examples and output. https://image-server.grav.catchit.xyz/

Markdown

![alt text](test.jpg "title text")

Result

alt text ">
<picture>
    <source media="(min-width: 769px)" srcset="image.webp 1x, image.webp 2x, image.webp 3x" type="image/webp">
    <source media="(min-width: 481px)" srcset="image.webp 1x, image.webp 2x, image.webp 3x" type="image/webp">
    <source srcset="image.webp 1x, image.webp 2x, image.webp 3x" type="image/webp">
    <img alt="alt text" title="title text" loading="lazy" src="images.jpeg" class="img-fluid" width="1296" height="864">
picture>

Support

For live chatting, please use Discord Chat Room - username xf for discussions directly related to the plugin.

For bugs, features, improvements, please ensure you create issues in the GitHub repository.

Installation

Like any other normal plugin, and it uses internal image processing.

FAQ

Why is the Quality so low for higher density (jpeg)?

A modern phone open uses a multiplier for fonts and other sizes because, normal 16px size (basic Browser 1rem size). Binary images can't be upscaled, compared to vector font. As result 1 pixel web would be displayed on e.g. 2x2 pixel on a high density display (phone). The image would look not that good. source supports higher density's won't show 2x2 or 3x3 blocks, it will use edges according to the image and high density makes the low quality invisible. Sometimes looks better, because high quality looks over-sharpen. (Hope that helps without going into jpeg algorithm.)

Breakpoint options and max width

The image width is always BEFORE the breakpoint is hit and last value is max Width.

My framework sues rem for max width and breakpoint

Images are pixel based and rem is simply a flexible browser value that is converted into pixel. Default is 16px is 1rem and can be changed in your browser settings (font, not scale). Binary image won't get more pixel based on that browser attribute.

What are the best settings?

Hard to answer question. Every image needs time to be generated (normally tiny files). So density 3 x 3 breakpoints (+ 1 x 3 default webp + 1 fallback) end up with 13 images that need to be generated,

Is webp safe to use?

Yes, you have a fallback img for ancient browsers, but is similar to picture in next FAQ entire.

https://caniuse.com/?search=webp

!No! IE Support out of box

You need IE, you need a picture polyfill and maybe different projects

https://caniuse.com/?search=picture

Not every browser supports loading

Yes, but most of them do. Even Safari as last major browser has it in technical preview. If a browser doesn't support it, it will load instantly. JS would need additional bandwidth and execution time on exactly the problem old devices and also added to any new device (browser).

https://caniuse.com/?search=loading

Class handling

Default class is only set, if nothing else is used. Create a new advanced set for class combinations.

What can I do with ratio?

Force a certain aspect ratio like 16:9 from a lot of screens. nice for same news header image size. It uses cropZoom from grav.

My source image is small...

Every density and breakpoint checks the source fiel size. The image won't upscale images. Binary can't really be upscaled without some kind of neural network trained with a lot of images.

Is Windows server supported

No, and I think it will fail. Windows Filesystem is messed up nightmare, and I have no device to test it (and also no interest). Linux and macOS should work without any problems.

You might also like...
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

Easily convert images with Glide
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

Optimize your images on the fly with Glide for Laravel.
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

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

PHP library to resize, scale and crop images.
PHP library to resize, scale and crop images.

PHP library to resize, scale and crop images.

Inline Images Protocol implementation for PHP.
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

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

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

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

Contao Image Alternatives This extensions expands the capabilities of using responsive images with art direction in Contao. You will have the possibil

Comments
  • Parse error

    Parse error

    Hi! Can't run it on XAMPP (Windows) nor Shared Hosting. PHP 7.4 It throws this error: Parse error: syntax error, unexpected ')', expecting '|' or variable (T_VARIABLE) in /xxx/public_html/user/plugins/image-server/image-server.php on line 80

    opened by 01Kuzma 2
  • Roadmap to stable release

    Roadmap to stable release

    Current state

    Alpha - at the moment Allowing changes on the API/twig function (arguments and their order)

    Next is properly stable after alpha. Testing it in a small project

    To-do

    • [x] Fully implement/test SVG support for classes
    • [ ] Finish a first version of documentation
      • [x] Min requirement
      • [ ] Explain how images are working and all that wonderful stuff.
      • [ ] Add section about grav 1.8 (adapter/on demand images)
    • [x] Wait for next admin release with patch for list defaults (works without, but more config effort)

    Nice2have

    • [ ] Next Gen Editor support with presets on images. Easy to use for editor

    Maybe some feedback on current state

    :)

    opened by xf- 0
This plugin adds a new image style for the Core Image block.

This plugin adds a new image style for the Core Image block. Introduction How to use? Go to Gutenberg Editor and add a image block. e.g. Add new image

Mahesh Waghmare 3 Feb 17, 2022
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.

Devscast 10 May 13, 2022
The Gregwar\Image class purpose is to provide a simple object-oriented images handling and caching API

Gregwar's Image class The Gregwar\Image class purpose is to provide a simple object-oriented images handling and caching API. Installation With compos

Grégoire Passault 958 Dec 29, 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
:racehorse: find the size of an image without downloading the whole file. Supports batch requests.

FasterImage FasterImage finds the dimensions or filetype of a remote image file given its uri by fetching as little as needed, based on the excellent

Will Washburn 58 Nov 30, 2022
Auto Image & file upload, resize and crop for Laravel eloquent model using Intervention image

Laravel ImageUp The qcod/laravel-imageup is a trait which gives you auto upload, resize and crop for image feature with tons of customization. Install

QCode.in 708 Dec 22, 2022
A Laravel Gravatar package for retrieving gravatar image URLs or checking the existance of an image.

Gravatar for Laravel 5.x, 6, 7 and 8 Installation First, pull in the package through Composer via the command line: composer require creativeorange/gr

Creativeorange 477 Dec 1, 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
PHPExif is a library which gives you easy access to the EXIF meta-data of an image

PHPExif v0.6.4 PHPExif is a library which gives you easy access to the EXIF meta-data of an image. PHPExif serves as a wrapper around some native or C

null 135 Dec 4, 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