info@ektanjali.com +91 99276-99286

CakePHP 4.x User Management Premium Plugin Version 4.0.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 template files as

<img src="<?php echo $this->Image->resize($dir, $photo, $width, $height, $options);?>">

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, Default is 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.

$options array of options. Check Image helper for options explanation.

For more information see Image Helper inside yourapp/plugins/Usermgmt/src/View/Helper/ImageHelper.php