Jump to Content

Objective HTML

Photo Frame

exp:photo_frame:photos

This method allows you to fetch photos from the database with standalone tags so that you are not required to use a channel entries loop and the fieldtype tags. It's important to note, that all variables are prefixed with "photo:" by default.

Parameters

field_name=

This parameter will return only photos from the defined field name.

field_id=

This parameter will return only photos from the defined field_id.

directory=

This parameter will allow you to output photos from a subdirectory inside of the parent upload directory. So for instance, if you want to output a photo using a native file manipulation, you can define that actual directory name here. If you define a parameter, a new template variable will be available.


{exp:photo_frame:photos directory="_medium"}
	{photo:_medium}
	{photo:_medium:url}
	{photo:_medium:file}
	{photo:_medium:file_name}
{/exp:photo_frame:photos}

limit=

This parameter will limit the number of photos returned.

offset=

This parameter will offset the number of photo returned.

order_by=

This parameter will change the order the photos returned.

prefix=

This parameter will change the default prefix, which is "photo:".


{exp:photo_frame:photos}
	{photo:file}	
	{photo:url}	
{/exp:photo_frame:photos}

{exp:photo_frame:photos prefix="var"}
	{var:file}	
	{var:url}	
{/exp:photo_frame:photos}

sort=

This parameter will change the way the photos are sorted.

where:your_field_name=

This parameter will allow you to add additional searches to the query.


Variables

count
The loop count starting at 1
index
The loop count starting at 0
total_photos
The total number of photos
is_first_photo
Is the loop iteration on the first photo. (Returns TRUE or FALSE)
is_last_photo
Is the loop iteration on the last photo. (Returns TRUE or FALSE)
site_id
The site id
field_id
The photo frame field id
entry_id
The parent entry id
order
The index representing the order of the photo
height
The photo's height
width
The photo's width
x
The X coordinate of the crop
x2
The X2 coordinate of the crop
y
The Y coordinate of the crop
y2
The Y2 coordinate of the crop
file
The server path of the framed photo
original_file
The server path of the original photo
file_name
The current name of the photo
original_file_name
The original name of the photo
title
The photo title
description
The photo description
your_directory
If you define a directory parameter, then the "your_directory" represents the value of the parameter. You would want to define this parameter if you want to use one of the native image manipulations which store the images in the subdirectories.
your_directory:url
This is the photo's url within the defined directory.
your_directory:file
This is the photo's server path within the defined directory.
your_directory:file_name
This is the photo's filename within the defined directory.
your_size
If you define a size parameter, this variable will be the value of that parameter and output the url of the photo of that size. So if you have a size called "small" this would be the variable.
your_size:url
The photo's url of the defined size.
your_size:file
The photo's server path of the defined size.
your_size:file_name
The photo's file name of the defined size.
your_size:height
The height of the defined photo size.
your_size:width
The width of the defined photo size.

Examples


{exp:photo_frame:photos}
	{photo:title}
	{photo:description}
	{photo:file}
	{photo:file_name}
	{photo:original_file}
	{photo:original_file_name}
	{photo:small}
	{photo:small:url}
	{photo:small:file}
	{photo:small:file_name}
	{photo:small:height}
	{photo:small:width}
	{photo:is_first_photo}
	{photo:is_last_photo}	
{/exp:photo_frame:photos}

{exp:photo_frame:photos field_id="1"}
	[vars]
{/exp:photo_frame:photos}

{exp:photo_frame:photos entry_id="1"}
	[vars]
{/exp:photo_frame:photos}

{exp:photo_frame:photos field_id="1" where:height="400"}
	[vars]
{/exp:photo_frame:photos}

{exp:photo_frame:photos entry_id="1" field_name="your_field"}
	[vars]
{/exp:photo_frame:photos}