ExpressionEngine Image Sizer 2.1

lightweight Image resizing for ExpressionEngine

This ExpressionEngine plugin will resize any JPG GIF or PNG image to the desired size specified in your EE tag and cache the resized image to the cache folder. If you update the original image a new resized version will be created. If the image is not on the server the tag will not return anything. The general architecture of this plug-in is setup in a way that it only processes images when needed.

{exp:imgsizer:size}

  • src= (required) the path from "webroot" to the image or the local URL to the image
    /images/news/moped.jpg or http://www.lumis.com/images/news/moped.jpg

  • width= the width you wish the image to resized to. the height is resized proportionately
    or
  • height= the height you wish the image to resized to. the width is resized proportionately
    or
  • auto= the size of the longest side. If the image is landscape, then this sets the width, else it sets the height.

    NOTE:
    • if you use just width the image will be scaled proportionately to that width
    • if you use just height the image will be scaled proportionately to that height
    • if you use both width and height, the image will be cropped and or scaled (from center) to match that width and height
    • if you use auto, the width and height parameters are ignored.
    • if "width" is = to "height" the image will be cropped from image center to make a square sized image.

  • quality="90" (optional for JPG images) ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default is the default value is (90).

  • greyscale="yes" (optional) if set to yes imagesizer will convert color images to greyscale

  • mask="90" (optional) Applys a Unsharp mask if the image is a jpg (only numerical Values)
  • mask_radius="0.5" (optional) defaults to 0.5 if not provided
  • mask_threshold="3" (optional) defaults to 3 if not provided

  • justcheck= (Single Tag only) if set to yes the tag will return a 1 if the source image exists. useful for php post processing

  • justurl= (Single Tag only) if set to yes the tag will only return the relative path to the image from http root useful for css background images or XML nodes

  • title= (Single Tag only) the title attribute of the image

  • alt= (Single Tag only) the alt attribute of the image

  • id= (Single Tag only) the id of the image

  • class= (Single Tag only) the class of the image

  • cache="no" allows you to turn off image caching (not a good idea) setting this to "no" means your images will be reprocessed every time the page is loaded (this param defaults to yes)

Example {exp:imgsizer:size}

updated v.2.1
  • width and height prams if both are used. now perform cropping and resizing to match the values
updated v.2.0.2
  • quality param for JPG output Compression
  • added greyscale output option
updated v.2.0
  • no longer uses EE's Image lib (requires GD lib be installed)
  • Transparency on GIF and PNG are maintained.
  • no longer creates a intermediate image for square sizing saving disk space
  • large image files are processed.
updated v.1.6.5
  • added options to turn of caching and more control over Unsharp Mask
updated v.1.6.1
  • Added Unsharp Mask - if you have your Image settings in the ExpressionEngine CP set to use GD2 and your image type is a jpg
updated v.1.6
  • Square sizing if "width" is = to "height" the image will be cropped from image center to make a square sized image
updated v.1.5.3 (Thanks to Erin Dalzell )
  • Auto Sizing = the size of the longest side. If the image is landscape, then this sets the width, else it sets the height.
updated v.1.5.1
  • uses Expression Engines filename security
  • Fixes a bug if EE was not installed in web-root. (Thanks to Gonzalingui)
Requirements / setup:
  • ExpressionEngine 1.6+ (it may work on older version but i started developing this on 1.6 and there is no reason i can think of not to upgrade)
  • requires GD lib be installed
  • setup: put pi.imgsizer.php in your plug-ins folder.
Download: ExpressionEngine image sizer 2.1

Visit the EE Forum for Questions