Resize Image by passing width and height in image url
When images are uploaded to civicrm (profile or custom field of image type), they are moved to civicrm/custom directory. And every time we requested that images same image are served.
In case we need these images in different dimensions, we load same images and then apply height and with attribute to img tag. if image size in MB and we are loading multiple contact images on certain pages then it take time load all images. To avoid this issue we can resize original image as per our requirement keep these resized image in separate directory.
Url Parameter :
https://dmaster.demo.civicrm.org/civicrm/contact/imagefile?photo=BU_Stacked_Logo_980877eb4a5a814a017b582fb2439d8f.png&width=150&height=150 https://dmaster.demo.civicrm.org/civicrm/file?reset=1&filename=BU_Stacked_Logo_980877eb4a5a814a017b582fb2439d8f.png&mime-type=image/png&width=150&height=150 https://dmaster.demo.civicrm.org/civicrm/file?reset=1&id=1&eid=202&width=150&height=150
This will create sub directory 'cache' (civicrm/custom/cache) and new resize image placed in this sub directory ( BU_Stacked_Logo_980877eb4a5a814a017b582fb2439d8f_w150_h150.png )
PR Submitted : https://github.com/civicrm/civicrm-core/pull/13057