ModelFiles module

Image

A model in the Files module, with 28 members for templates, 19 API properties and 26 members for admin templates.

Files\Models\Frontend\Image Files\Models\Api\Image Files\Models\Backend\Image Also in Files: FavoriteFilename FavoriteFolder File FileRevision Filename FilenameComment Folder FolderComment ImageRevision SharedFilename VirtualFile
View
What Smarty and Twig templates receive. Properties in REST API responses and job payloads. What admin screen templates receive when you override them.

Templates view

Properties 23

Take no arguments.

# __toString() Templates only
string
Handle string representation for response model
# getPath()
string
Get the path for this image
# getFullPath()
string
Get the full path for this image. Alias for getPath.
# getMimeType()
string
Get the mime type of the image
# getFormat()
string
Get the format of the image
# isBlank()
bool
Return the information that this is not a blank image
# getType()
string
Get the type of the image. Always returns "image".
# getWidth()
int
# getHeight()
int
# getAspectRatio()
float
# getName()
?string
# getId()
?int
# getFilename()
?Filename
# getCreated()
?DateTime
Get the date the record was created.
# getModified()
?DateTime
Get the last modification date for the record.
# getActiveRevision()
?ImageRevision
# getRevisions()
?Collection<ImageRevision>
# getLastRevision()
?ImageRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned

Methods 5

Take arguments. The API serialises only getters that need none.

# toFormat(string $targetFormat, ?array $sourceFormats) Templates only
void
Convert the image to the target format. Optionally only performs the transformation if the source format is
contained in the provided formats. Using this method, it is possible to convert images matching a certain format
(like png and gif) to the target formats (like jpeg or webp), while leaving other images untouched.
# toOptimizedFormat(string $targetFormat) Templates only
void
Get the image in an optimized format. Only converts the image if it does not already have the target format,
and if conversion is possible. SVG images are never converted to other formats.
# getHtml(array $attributes)
string
Get the html image tag for this image
# getResized(?int $width, ?int $height, string $resizeStrategy)
Image
Get a resized version of the active revision of the image Tries to fetch the image first, otherwise will create and return it Will save the resized copy and potentially also the current image, if the dimensions were not determined previously
# getRevisionById(int $id)
?ImageRevision
Get the revision with the specified id

API & Jobs view

API & JobsEach property is a key in REST API responses and job payloads. Its name is the template getter without get, is or has. Methods that need arguments are not available here.

Properties 19

Read-only values on the record.

# path
string
Get the path for this image
# fullPath
string
Get the full path for this image. Alias for getPath.
# mimeType
string
Get the mime type of the image
# format
string
Get the format of the image
# blank
bool
Return the information that this is not a blank image
# type
string
Get the type of the image. Always returns "image".
# width
int
# height
int
# aspectRatio
float
# name
?string
# id
?int
# filename
?Filename
# created
?DateTime
Get the date the record was created.
# modified
?DateTime
Get the last modification date for the record.
# activeRevision
?ImageRevision
# revisions
?Collection<ImageRevision>
# lastRevision
?ImageRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# tags
?Collection<Tag>
# categories
?Collection<Category>

Admin view

AdminAvailable in cdna-admin templates. Copy an admin template into your site repository to change how this record is edited.

Properties 23

Take no arguments.

# getPath()
string
Get the path for this image
# getFullPath()
string
Get the full path for this image. Alias for getPath.
# getMimeType()
string
Get the mime type of the image
# getFormat()
string
Get the format of the image
# isBlank()
bool
Return the information that this is not a blank image
# getType()
string
Get the type of the image. Always returns "image".
# getWidth()
int
# getHeight()
int
# getAspectRatio()
float
# getName()
?string
# getId()
?int
# getFilename()
?Filename
# getCreated()
?DateTime
Get the date the record was created.
# getModified()
?DateTime
Get the last modification date for the record.
# getActiveRevision()
?ImageRevision
# getRevisions()
?Collection<ImageRevision>
# getLastRevision()
?ImageRevision
Get the last revision for the entity. If a revision has been added, this will be the newly added revision.
# getTags()
?Collection<Tag>
# getCategories()
?Collection<Category>
# isNewRecord() Not in API & Jobs
bool
Check if the record is a new record
# isHierarchicalModel() Not in API & Jobs
bool
Check whether a model is a hierarchical model, i.e. can have children
# isVersionedModel() Not in API & Jobs
bool
Check whether a model is versioned
# getDropzoneConfig() Admin only
array
Get the dropzone config for this image

Methods 3

Take arguments. The API serialises only getters that need none.

# getHtml(array $attributes)
string
Get the html image tag for this image
# getResized(?int $width, ?int $height, string $resizeStrategy)
Image
Get a resized version of the active revision of the image Tries to fetch the image first, otherwise will create and return it Will save the resized copy and potentially also the current image, if the dimensions were not determined previously
# getRevisionById(int $id)
?ImageRevision
Get the revision with the specified id