info@ektanjali.com +91 99276-99286

CakePHP 2.x User Management Premium Plugin Version 2.2.x

Image Resize Helper

I have developed image resize helper for this plugin. It is very helpful for resizing the images. It cached the resized images for future use.

How to use this helper
1. Include Image helper in controller's Helper variable for e.g. public $helpers = array('Usermgmt.Image');
2. This helper has a resize function which gives you image src URL.
3. You can call this function in View file as

<img src="<?php echo $this->Image->resize($dir$photo$width$height$aspect$crop?>">

Where
$dir (String) is directory name or sub directory name with path inside webroot directory
for e.g. "img/umphotos" or "img/umphotos/sub_directory_name" or so on.

$photo (String) is image name inside the given directory name. It may includes path with image name
for e.g. "mypic.jpg" or "sub_directory_name/mypic.jpg" or so on.
If you pass $photo as null or blank or image is not exist then It will show default image.

$width (Integer) is desired width of image you want to displayed. It is mandatory to paas in function.

$height (Integer or Null) is desired height of image you want to displayed. It can be null. If you pass height is null then $aspect must be true.

$aspect (Boolean) is true or false. If you want desired width and height fixed then pass it false otherwise pass it true. If you pass true in that case image can be stretched.

$crop (Boolean) is true or false. If you want desired width, height fixed and not stretched image then pass it true otherwise pass it false.

For more information see Image Helper inside yourapp/app/Plugin/Usermgmt/View/Helper/ImageHelper.php