Skip to content
Roger Hughes edited this page May 19, 2022 · 2 revisions

Heading

Pea is an image resizing and compression addon for ExpressionEngine Input: JPG, PNG Output: WebP, JPG

Use if:

You want to resize and compress images that have been uploaded to EE

How to use

  • Install the extension
  • WebP support is required, visit the settings screen, an error message will appear at the top of the screen if you don't have WebP support

Output a HTML5 <picture> tag with appropriate JPEG fallback for older browsers. {exp:pea:picturetag src="/assets/boats.png"}

Output just the path to the WebP file, for your own dynamic use (if webp support is missing, the JPEG path will be output instead. {exp:pea:webp src="/assets/boats.png"}

Output just the path to the JPEG file. {exp:pea:jpeg src="/assets/boats.png"}

Output the path to WebP if the accept header exists in $_SERVER['HTTP_ACCEPT'], otherwise output the JPEG {exp:pea:detect src="/assets/boats.png"}

Parameters

src - relative path to the source image

width - (optional) pixel width of the output

quality_jpg - (optional) JPEG output quality, 0 = lowest, 100 = highest

quality_webp - (optional) WEBP output quality, 0 = lowest, 100 = highest

id - (optional) id paramter for the output picture tag

alt - (optional) alt parameter for the ouput picture tag

Changelog

1.2.1 - 2020-11-21

  • handle full url being passed in as source

1.2.0 - 2020-08-05

  • catch error if source file is missing
  • fix bug where quality settings were ignored
  • add purge cache function

1.1.2 - 2020-08-04

  • plugin file still referenced autoload

1.1.1 - 2020-08-03

  • fix install error

1.1.0 - 2020-07-28

  • add the 'detect' tag

1.0.0 - 2020-07-27

  • initial release

Todo

  • something to do with comparing the images to work out the best compression automatically
    • Jenssegers\ImageHash
    • Robert Lerner code in compare.php
  • super-scaling to improve quality
  • ImageMagick support
  • keep an eye on this https://www.caniuse.com/#feat=avif

Credits

Icons by monkik from Flaticon

Clone this wiki locally