Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
C
Core
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 913
    • Issues 913
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • Development
  • Core
  • Issues
  • #501

Closed
Open
Opened Nov 02, 2018 by sunil@sunil

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

Edited Nov 02, 2018 by sunil
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: dev/core#501