Image Sizes Module

Image Sizes is a system Photon CMS module that is used to define formats to which uploaded images will be automatically resized to.

Table of Contents
  1. Default Image Sizes
  2. Image Size Module Options
  3. Rebuild Resized Images Command

Default Image Sizes

Initially, Photon CMS has two entries inside the Image Sizes module: 

  1. Thumbnail (120x90)
  2. Large Image (960xauto)

This means that any uploaded image file, apart from being saved in it's original format, will be automatically resized to these two additional image sizes: Thumbnail image 120x90px and Large Image sized 960px horizontally, while the height will be automatically calculated.

Uploading the download.png file would result in having these three files saved in the /storage/app/public/assets folder:


Image Size Module Options

Let's inspect available Image Size Module options:

Name - a human readable image size name.

Width - width in pixels to which the image will be resized. If you set this option to zero, width will be automatically calculated in proportion when height is resized to the desired length.

Height - height in pixels to which the image will be resized. If you set this option to zero, height will be automatically calculated in proportion when width is resized to the desired length.

Lock Width and Lock Height - Activating both options will lock the aspect ratio in the Image Sizes cropping tool.

You are free to add any number of image sizes.

Rebuild Resized Images Command

If you have an existing library of assets and you need to add another image size, adding a new image size won't automatically create new image size files for all existing image assets. To rebuild all resized images for specific image size run this Artisan command from your project web root folder:

php artisan photon:rebuild-resized-images {sizeId} {--showLog} {--force}

sizeIdYesId of image size that needs to be regenerated.
–showLogNoOption that indicates if log should be printed out in console.
–forceNoOption that indicates if resized image should be regenerated if it already exists. By default existing resized images will be skipped.

Sign-up to stay informed about news and updates.