ModelFiles module
Image
A model in the Files module, with 28 members for templates, 19 API properties and 26 members for admin templates.
Templates view
Properties 23
Take no arguments.
-
#
getWidth() -
int -
#
getHeight() -
int -
#
getAspectRatio() -
float -
#
getName() -
?string -
#
getId() -
?int -
#
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> -
#
isHierarchicalModel()Not in API & Jobs -
bool - Check whether a model is a hierarchical model, i.e. can have children
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. -
#
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
No members match the filter.
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.
-
#
width -
int -
#
height -
int -
#
aspectRatio -
float -
#
name -
?string -
#
id -
?int -
#
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>
No members match the filter.
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.
-
#
getWidth() -
int -
#
getHeight() -
int -
#
getAspectRatio() -
float -
#
getName() -
?string -
#
getId() -
?int -
#
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> -
#
isHierarchicalModel()Not in API & Jobs -
bool - Check whether a model is a hierarchical model, i.e. can have children
Methods 3
Take arguments. The API serialises only getters that need none.
-
#
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
No members match the filter.