Jump to Content

Objective HTML

Photo Frame

exp:photo_frame:resize

This method allows you to dynamically resize your photos using templates tags instead of relying on the fieldtype.

Parameters

prefix=

This parameter sets the variable prefix. By default, the prefix is set to cache.

cache_path=

This parameter sets the base cache file path for the generated photos. By default Photo Frame will defer to your config files for the default values, but if desired, you can override them with parameter right within the template.

cache_url=

This parameter sets the base cache URL for the generated photos. By default Photo Frame will defer to your config files for the default values, but if desired, you can override them with parameter right within the template.

height=

This parameter sets the height of the resized photo. Height and width are required if no ratio is specified. However, if a ratio is specified, only height or width is required (not both).

id=

This parameter sets the photo ID. If the same photo is cropped multiple times, be sure to set an ID to those crops are unique and don't override another.

path=

This parameter sets the file path of the photo to be cropped. This parameter is required and can be static or dynamic.

prefix=

This parameter sets the variable prefix. By default, the prefix is set to cache.

resize=

This parameter set the resize mode. This parameter will tell Photo Frame to resize the cropped photo if necessary. By default this parameter is set to TRUE. If set to FALSE, no photo resizing will be performed after the crop.

mode=

This parameter sets the crop mode. This parameter can be 1 of 3 values: crop, fit, or stretch. By default this parameter is set to crop.

width=

This parameter sets the width of the resized photo. Width and height are required if no ratio is specified. However, if a ratio is specified, only width or height is required (not both).

x=

This parameter sets the X coordinate of the focal point, which is the center of the crop.

y=

This parameter set the Y coordinate of the focal point, which is the center of the crop.


Variables

url
The url of the resized photo.
path
The file path of the resized photo.
file
The file path of the resized photo. This is an alias to the `path` variable.

Examples


{exp:channel:entries channel="galleries"}
	
	{gallery_photos}

		{photo:focal_point}

			{exp:photo_frame:resize 
				cache="/Users/justinkimbrell/Sites/photo-frame/public_html/assets/img/cache/"
				path="{photo:file}"
				x="{x}"
				y="{y}"
				width="4000"
				ratio="2.5:1"
			}

				

			{/exp:photo_frame:resize}

		{/photo:focal_point}

	{/gallery_photos}

{/exp:channel:entries}