ImageFactory
class ImageFactory (View source)
Provides a factory for image objects.
Properties
| protected ImageToolkitManager | $toolkitManager | The image toolkit plugin manager. |
|
| protected string | $toolkitId | The image toolkit ID to use for this factory. |
Methods
Sets the ID of the image toolkit.
Gets the ID of the image toolkit currently in use.
Constructs a new Image object.
Returns the image file extensions supported by the toolkit.
Details
__construct(ImageToolkitManager $toolkit_manager)
Constructs a new ImageFactory object.
$this
setToolkitId(string $toolkit_id)
Sets the ID of the image toolkit.
string
getToolkitId()
Gets the ID of the image toolkit currently in use.
ImageInterface
get(string|null $source = NULL, string|null $toolkit_id = NULL)
Constructs a new Image object.
Normally, the toolkit set as default in the admin UI is used by the factory to create new Image objects. This can be overridden through \Drupal\Core\Image\ImageInterface::setToolkitId() so that any new Image object created will use the new toolkit specified. Finally, a single Image object can be created using a specific toolkit, regardless of the current factory settings, by passing its plugin ID in the $toolkit_id argument.
array
getSupportedExtensions(string|null $toolkit_id = NULL)
Returns the image file extensions supported by the toolkit.