Image Field Type
The image field type allows you to upload and resize an image.
Parameters
Parameter | Example |
---|---|
Upload Folder | Interfaces with the PyroCMS files module. Create an upload folder in the files module and select it here. |
Resize Width | Number of pixels to resize the image to width-wise. Can be left blank. |
Resize Height | Number of pixels to resize the image to height-wise. If left blank while the Resize Height field is filled, this will be calculated based on the dimensions of the image. |
Allowed Types | Allowed types separated by pipe characters. Ex: jpg|gif|png. |
Output
The image field type outputs the following nested variables.
Variable | Example |
---|---|
{{ field_slug:filename }} | File name of the image. |
{{ field_slug:image }} | Full path to the image. |
{{ field_slug:img }} | A full img tag with the image. Adds the image file name as the "alt" attribute. |
{{ field_slug:ext }} | The image extension. |
{{ field_slug:mimetype }} | The image mimetype. |
{{ field_slug:width }} | Width of the full image. |
{{ field_slug:height }} | Height of the full image. |
{{ field_slug:thumb }} | Full URL to a 200px width thumb of the image. Returns the actual image if it is under 200px wide. |
{{ field_slug:thumb_img }} | Img tag for a 200px width thumb of the image. Returns the actual image if it is under 200px wide. File name is set as the "alt" attribute. |