|
| __construct (\Magento\Framework\Image\Adapter\AdapterInterface $adapter, $fileName=null) |
|
| open () |
|
| display () |
|
| save ($destination=null, $newFileName=null) |
|
| rotate ($angle) |
|
| crop ($top=0, $left=0, $right=0, $bottom=0) |
|
| resize ($width, $height=null) |
|
| keepAspectRatio ($value) |
|
| keepFrame ($value) |
|
| keepTransparency ($value) |
|
| constrainOnly ($value) |
|
| backgroundColor ($value) |
|
| quality ($value) |
|
| watermark ( $watermarkImage, $positionX=0, $positionY=0, $watermarkImageOpacity=30, $repeat=false) |
|
| getMimeType () |
|
| getImageType () |
|
| process () |
|
| instruction () |
|
| setImageBackgroundColor ($color) |
|
| setWatermarkPosition ($position) |
|
| setWatermarkImageOpacity ($imageOpacity) |
|
| setWatermarkWidth ($width) |
|
| setWatermarkHeight ($height) |
|
| getOriginalWidth () |
|
| getOriginalHeight () |
|
| createPngFromString ($text, $font='') |
|
◆ __construct()
Constructor
- Parameters
-
Image\Adapter\AdapterInterface | $adapter | |
string | null | $fileName | |
Definition at line 31 of file Image.php.
◆ backgroundColor()
backgroundColor |
( |
|
$value | ) |
|
Get/set backgroundColor
- Parameters
-
- Returns
- array|null
Definition at line 172 of file Image.php.
174 return $this->_adapter->backgroundColor(
$value);
◆ constrainOnly()
Get/set constrainOnly
- Parameters
-
- Returns
- bool
Definition at line 161 of file Image.php.
163 return $this->_adapter->constrainOnly(
$value);
◆ createPngFromString()
createPngFromString |
( |
|
$text, |
|
|
|
$font = '' |
|
) |
| |
Create Image from string
- Parameters
-
string | $text | |
string | $font | Path to font file |
- Returns
- $this
Definition at line 343 of file Image.php.
345 $this->_adapter->createPngFromString(
$text, $font);
◆ crop()
crop |
( |
|
$top = 0 , |
|
|
|
$left = 0 , |
|
|
|
$right = 0 , |
|
|
|
$bottom = 0 |
|
) |
| |
Crop an image.
- Parameters
-
int | $top | Default value is 0 |
int | $left | Default value is 0 |
int | $right | Default value is 0 |
int | $bottom | Default value is 0 @access public |
- Returns
- void
Definition at line 104 of file Image.php.
106 $this->_adapter->crop($top, $left, $right, $bottom);
◆ display()
Display handled image in your browser
@access public
- Returns
- void
Definition at line 64 of file Image.php.
66 $this->_adapter->display();
◆ getImageType()
Get image type of handled image
@access public
- Returns
- int
Definition at line 230 of file Image.php.
232 return $this->_adapter->getImageType();
◆ getMimeType()
Get mime type of handled image
@access public
- Returns
- string
Definition at line 219 of file Image.php.
221 return $this->_adapter->getMimeType();
◆ getOriginalHeight()
Retrieve original image height
- Returns
- int|null
Definition at line 331 of file Image.php.
333 return $this->_adapter->getOriginalHeight();
◆ getOriginalWidth()
Retrieve original image width
- Returns
- int|null
Definition at line 321 of file Image.php.
323 return $this->_adapter->getOriginalWidth();
◆ instruction()
Instruction
@access public
- Returns
- void
Definition at line 251 of file Image.php.
◆ keepAspectRatio()
keepAspectRatio |
( |
|
$value | ) |
|
Get/set keepAspectRatio
- Parameters
-
- Returns
- bool
Definition at line 128 of file Image.php.
130 return $this->_adapter->keepAspectRatio(
$value);
◆ keepFrame()
Get/set keepFrame
- Parameters
-
- Returns
- bool
Definition at line 139 of file Image.php.
141 return $this->_adapter->keepFrame(
$value);
◆ keepTransparency()
keepTransparency |
( |
|
$value | ) |
|
Get/set keepTransparency
- Parameters
-
- Returns
- bool
Definition at line 150 of file Image.php.
152 return $this->_adapter->keepTransparency(
$value);
◆ open()
Opens an image and creates image handle
@access public
- Returns
- void
- Exceptions
-
Definition at line 47 of file Image.php.
49 $this->_adapter->checkDependencies();
51 if (!file_exists($this->_fileName)) {
52 throw new \Exception(
"File '{$this->_fileName}' does not exist.");
55 $this->_adapter->open($this->_fileName);
◆ process()
◆ quality()
Get/set quality, values in percentage from 0 to 100
- Parameters
-
- Returns
- int
Definition at line 183 of file Image.php.
185 return $this->_adapter->quality(
$value);
◆ resize()
resize |
( |
|
$width, |
|
|
|
$height = null |
|
) |
| |
Resize an image
- Parameters
-
int | $width | |
int | $height | @access public |
- Returns
- void
Definition at line 117 of file Image.php.
119 $this->_adapter->resize($width, $height);
◆ rotate()
Rotate an image.
- Parameters
-
- Returns
- void
Definition at line 89 of file Image.php.
91 $this->_adapter->rotate($angle);
◆ save()
save |
( |
|
$destination = null , |
|
|
|
$newFileName = null |
|
) |
| |
Save handled image into file
- Parameters
-
null | string | $destination | Default value is NULL |
null | string | $newFileName | Default value is NULL @access public |
- Returns
- void
Definition at line 77 of file Image.php.
79 $this->_adapter->save($destination, $newFileName);
◆ setImageBackgroundColor()
setImageBackgroundColor |
( |
|
$color | ) |
|
Set image background color
- Parameters
-
- Returns
- void
@noinspection PhpUndefinedFieldInspection
Definition at line 262 of file Image.php.
265 $this->_adapter->imageBackgroundColor = intval($color);
◆ setWatermarkHeight()
setWatermarkHeight |
( |
|
$height | ) |
|
Set watermark height
- Parameters
-
- Returns
- $this
Definition at line 310 of file Image.php.
312 $this->_adapter->setWatermarkHeight($height);
◆ setWatermarkImageOpacity()
setWatermarkImageOpacity |
( |
|
$imageOpacity | ) |
|
Set watermark image opacity
- Parameters
-
- Returns
- $this
Definition at line 286 of file Image.php.
288 $this->_adapter->setWatermarkImageOpacity($imageOpacity);
◆ setWatermarkPosition()
setWatermarkPosition |
( |
|
$position | ) |
|
Set watermark position
- Parameters
-
- Returns
- $this
Definition at line 274 of file Image.php.
276 $this->_adapter->setWatermarkPosition($position);
◆ setWatermarkWidth()
setWatermarkWidth |
( |
|
$width | ) |
|
Set watermark width
- Parameters
-
- Returns
- $this
Definition at line 298 of file Image.php.
300 $this->_adapter->setWatermarkWidth($width);
◆ watermark()
watermark |
( |
|
$watermarkImage, |
|
|
|
$positionX = 0 , |
|
|
|
$positionY = 0 , |
|
|
|
$watermarkImageOpacity = 30 , |
|
|
|
$repeat = false |
|
) |
| |
Adds watermark to our image.
- Parameters
-
string | $watermarkImage | Absolute path to watermark image. |
int | $positionX | Watermark X position. |
int | $positionY | Watermark Y position. |
int | $watermarkImageOpacity | Watermark image opacity. |
bool | $repeat | Enable or disable watermark brick. @access public |
- Exceptions
-
Definition at line 200 of file Image.php.
207 if (!file_exists($watermarkImage)) {
208 throw new \Exception(
"Required file '{$watermarkImage}' does not exists.");
210 $this->_adapter->watermark($watermarkImage, $positionX, $positionY, $watermarkImageOpacity, $repeat);
◆ $_adapter
◆ $_fileName
The documentation for this class was generated from the following file: