Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Latest commit

 

History

History
46 lines (35 loc) · 1.93 KB

README.textile

File metadata and controls

46 lines (35 loc) · 1.93 KB

ED Image resizer for ExpressionEngine 2.x

Resize images on the fly

Installation

  1. Copy pi.ed_imageresizer.php to system/expressionengine/third_party/ed_imageresizer/
  2. Add path variables to your config at system/expressionengine/config/config.php:
$config['ed_server_path'] = '/var/www/html/'; // Server path to your site's web root
$config['ed_cache_path'] = '/var/www/html/media/images/resizer_cache/'; // Server path to where your resized images should be stored

Usage

Parameters

  • image (string) required : the file to resize
  • maxWidth (integer) : maximum width of the resized image
  • maxHeight (integer) : maximum height of the resized image
  • forceWidth (boolean “yes” or “no”, default “no”) : will force the width, even if the original’s width is less
  • forceHeight (boolean “yes” or “no”, default “no”) : will force the height, even if the original’s height is less
  • cropratio (string format “integer:integer”) : crops the image to the defined ratio
  • default (string) : a backup image to use if the image is not found
  • alt (string) : an alt tag for the image
  • class (string) : a class for the image tag
  • id (string) : an ID for the image tag
  • title (string) : a title for the image tag
  • href_only (boolean “yes” or “no”, default “no”) : if yes, will return only the href, not the image tag
  • debug (boolean “yes” or “no”, default “no”) : will optionally output an error message if one is encountered, otherwise will fail silently
  • grayscale (boolean “yes” or “no”, default “no”) : grayscales the resized image

Usage example

{exp:ed_imageresizer
    image="{my_image_field}"
    default="/images/site/default_image.png"
    maxWidth="100"
    cropratio="100:120"
    class="my_class"
    alt="Image description"
    grayscale="yes"
    }

Would then output the following:

<img src="/media/images/resizer_cache/resized_image.jpg" width="100" height="120" alt="Image description" />