Image ​
- Type
- Class
- Namespace
- craft\web\twig\variables
- Inherits
- craft\web\twig\variables\Image
- Since
- 3.0.0
Class Image variable.
Protected Properties ​
| Property | Description |
|---|---|
| path | string, null |
| size | array, null |
| url | string, null |
path ​
size ​
url ​
Public Methods ​
| Method | Description |
|---|---|
| __construct() | Constructor |
| getContents() | Returns the file’s contents. |
| getDataUrl() | Returns a base64-encoded data URL for the image. |
| getHeight() | Returns the image's height. |
| getMimeType() | Returns the file’s MIME type, if it can be determined. |
| getPath() | Returns the image’s path. |
| getSize() | Returns an array of the width and height of the image. |
| getUrl() | Returns the image's URL. |
| getWidth() | Returns the image's width. |
__construct() ​
Constructor
Arguments ​
getContents() ​
- Since
- 3.7.27
Returns the file’s contents.
Returns ​
getDataUrl() ​
- Since
- 3.7.27
Returns a base64-encoded data URL for the image.
Returns ​
getHeight() ​
Returns the image's height.
Returns ​
getMimeType() ​
- Since
- 3.7.27
Returns the file’s MIME type, if it can be determined.
Returns ​
getPath() ​
- Since
- 3.7.27
Returns the image’s path.
Returns ​
getSize() ​
Returns an array of the width and height of the image.
Returns ​
getUrl() ​
Returns the image's URL.
Returns ​
getWidth() ​
Returns the image's width.