info@ektanjali.com +91 99276-99286

CakePHP 3.x User Management Premium Plugin Version 3.3.x

Image Resize Helper

We have a image resize helper in this plugin. It is very helpful for resizing the images. It cached the resized images for future use.

How to use this helper


1. This helper has a resize function which gives you image src URL.
2. You can call this function in View ctp files 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", "library/umphotos" or so on.

$photo (String) is image name inside the given directory name. It may includes path with image name 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 display. It is mandatory to pass in function.

$height (Integer or Null) is desired height of image you want to display. 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/plugins/Usermgmt/src/View/Helper/ImageHelper.php