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. |
TransformedImage |
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. |
TransformedImage |
getPath() | Get the path for this image | 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 | TransformedImage |
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() | Get the width of the image in pixels | int |
getHeight() | Get the height of the image in pixels | int |
getName() | Get the name of the image revision - this is usually used as ALT text | string |
TransformedImage
Image class that represents an image after it has been transformed