File
File fields utilize the built-in file browser to store uploaded files and images for your publishers.
note
The following examples use a field named file_field
. This should be replaced with your field name.
- Twig
- Blade
{{ entry.file_field }}
{{ $entry->file_field }}
Variables
- Twig
- Blade
{{ entry.file_field.credit }}
{{ entry.file_field.description }}
{{ entry.file_field.directory_id }}
{{ entry.file_field.directory_title }}
{{ entry.file_field.extension }}
{{ entry.file_field.file_id }}
{{ entry.file_field.file_name }}
{{ entry.file_field.file_size }}
{{ entry.file_field.height }}
{{ entry.file_field.id_path }}
{{ entry.file_field.location }}
{{ entry.file_field.mime_type }}
{{ entry.file_field.modified_date }}
{{ entry.file_field.path }}
{{ entry.file_field.title }}
{{ entry.file_field.upload_date }}
{{ entry.file_field.url }}
{{ entry.file_field.width }}
{{ $entry->file_field->credit }}
{{ $entry->file_field->description }}
{{ $entry->file_field->directory_id }}
{{ $entry->file_field->directory_title }}
{{ $entry->file_field->extension }}
{{ $entry->file_field->file_id }}
{{ $entry->file_field->file_name }}
{{ $entry->file_field->file_size }}
{{ $entry->file_field->height }}
{{ $entry->file_field->id_path }}
{{ $entry->file_field->location }}
{{ $entry->file_field->mime_type }}
{{ $entry->file_field->modified_date }}
{{ $entry->file_field->path }}
{{ $entry->file_field->title }}
{{ $entry->file_field->upload_date }}
{{ $entry->file_field->url }}
{{ $entry->file_field->width }}
Parameters
- Twig
- Blade
{{ entry.file_field.parameters({wrap: 'link'}) }}
{{ $entry->file_field->parameters(['wrap' => 'link']) }}
Modifiers
Rotate
Rotate the image.
- Twig
- Blade
{{ entry.file_field.rotate({angle: 90}) }}
{{ $entry->file_field->rotate(['angle' => 90]) }}
Crop
Crop the image.
- Twig
- Blade
{{ entry.file_field.crop({width: 100, height: 100}) }}
{{ $entry->file_field->crop(['width' => 100, 'height' => 100]) }}
Resize
Resize the image.
- Twig
- Blade
{{ entry.file_field.resize({width: 100, height: 100}) }}
{{ $entry->file_field->resize(['width' => 100, 'height' => 100]) }}
WebP
Convert the image to WEBP format.
- Twig
- Blade
{{ entry.file_field.webp({width: 100, height: 100}) }}
{{ $entry->file_field->webp(['width' => 100, 'height' => 100]) }}
Resize And Crop
Resize the image and then crop it.
- Twig
- Blade
{{ entry.file_field.resize_crop({'resize:width': 100, 'crop:width': 100}) }}
{{ $entry->file_field->resize_crop(['resize:width' => 100, 'crop:height' => 100]) }}
Pre-defined Manipulation
- Twig
- Blade
{{ entry.file_field.manipulation('manipulation_name') }}
{{ $entry->file_field->manipulation('manipulation_name') }}
Chaining Modifiers
ExpressionEngine 7.3 introduced the ability to chain modifiers. This can be a very valuable tool when working with files if you want to manipulate a modified file even further.
- Twig
- Blade
{{ entry.file_field.manipulation('manipulation_name').crop({width: 100, height: 100}) }}
{{ $entry->file_field->manipulation('manipulation_name')->crop(['width' => 100, 'height' => 100]) }}
info
See the ExpressionEngine Documentation for more information on the File fieldtype