Frontend | Backend | Api

Files\Models\Frontend\Image

Image

Method Description Returns
toFormat(string $targetFormat, ?array $sourceFormats) 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) 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.
__toString() Handle string representation for response model string
getPath() Get the path for this image string
getFullPath() Get the full path for this image. Alias for getPath. string
getHtml(array $attributes) Get the html image tag for this image string
getResized(?int|null $width, ?int|null $height, string $resizeStrategy) 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 Image
getMimeType() Get the mime type of the image string
getFormat() Get the format of the image string
isBlank() Return the information that this is not a blank image bool
getType() Get the type of the image. Always returns "image". string
getWidth() int
getHeight() int
getAspectRatio() float
getName() string
getId() int
getFilename() Filename
getCreated() Get the date the record was created. DateTime
getModified() Get the last modification date for the record. DateTime
getActiveRevision() ImageRevision
getRevisionById(int $id) Get the revision with the specified id ImageRevision
getRevisions() Collection (ImageRevision)
getLastRevision() Get the last revision for the entity. If a revision has been added, this will be the newly added revision. ImageRevision
getTags() Collection (Tag)
getCategories() Collection (Category)
isNewRecord() Check if the record is a new record bool
isHierarchicalModel() Check whether a model is a hierarchical model, i.e. can have children bool
isVersionedModel() Check whether a model is versioned bool