|
| __construct ($imageData, $bmpSupport=false) |
|
| hasValidGdImage () |
|
| setMemory ($imageWidth, $imageHeight, $imageBits, $imageChannels) |
|
| createFromBmp ($data) |
|
| resize ($maxWidth, $maxHeight, $quality=80, $useHigherFactor=false) |
|
| getData ($format=null, $quality=80) |
|
| getGDImage () |
|
| getDataSize () |
|
| getWidth () |
|
| getHeight () |
|
| getMimeType () |
|
| crop ($x, $y, $width, $height) |
|
| rotate ($degrees, $bgcolor=0) |
|
| getInfo () |
|
|
static | create ($data, $bmpSupport=false) |
|
static | parseSize ($size) |
|
static | isSupportedExtension ($extension, $bmpSupport=false) |
|
static | mimeTypeFromExtension ($extension) |
|
static | calculateAspectRatio ($maxWidth, $maxHeight, $actualWidth, $actualHeight, $useHigherFactor=false) |
|
| fastCopyResampled (&$dstImage, $srcImage, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH, $quality=3) |
|
|
| $width |
|
| $height |
|
| $mime |
|
| $bits |
|
| $channels |
|
| $gdImage |
|
| $dataSize |
|
| $resizeQuality |
|
|
static | $supportedExtensions = ['jpg', 'jpeg', 'gif', 'png'] |
|
The Image class.
The class used for image processing.
◆ __construct()
__construct |
( |
|
$imageData, |
|
|
|
$bmpSupport = false |
|
) |
| |
Constructor.
- Parameters
-
string | $imageData | image data |
bool | $bmpSupport | true if bitmaps are supported (be aware of poor efficiency!) |
- Exceptions
-
CKFinderException | in case the image could not be initialized properly |
◆ calculateAspectRatio()
static calculateAspectRatio |
( |
|
$maxWidth, |
|
|
|
$maxHeight, |
|
|
|
$actualWidth, |
|
|
|
$actualHeight, |
|
|
|
$useHigherFactor = false |
|
) |
| |
|
static |
Returns the aspect ratio size as an associative array:.
array
(
[width] => 80
[heigth] => 120
)
- Parameters
-
int | $maxWidth | requested width |
int | $maxHeight | requested height |
int | $actualWidth | original width |
int | $actualHeight | original height |
bool | $useHigherFactor | defines which factor should be used to calculate the new size. For example:
- original image size 800x400
- calculateAspectRatio(300, 200, 800, 400, false) will return 300x150
- calculateAspectRatio(300, 200, 800, 400, true) will return 400x200
|
- Returns
- array
◆ create()
static create |
( |
|
$data, |
|
|
|
$bmpSupport = false |
|
) |
| |
|
static |
The factory method.
- Parameters
-
string | $data | |
bool | $bmpSupport | |
- Returns
- Image
◆ createFromBmp()
◆ fastCopyResampled()
fastCopyResampled |
( |
& |
$dstImage, |
|
|
|
$srcImage, |
|
|
|
$dstX, |
|
|
|
$dstY, |
|
|
|
$srcX, |
|
|
|
$srcY, |
|
|
|
$dstW, |
|
|
|
$dstH, |
|
|
|
$srcW, |
|
|
|
$srcH, |
|
|
|
$quality = 3 |
|
) |
| |
|
static |
- See also
- http://pl.php.net/manual/en/function.imagecopyresampled.php Replacement to
imagecopyresampled
that will deliver results that are almost identical except MUCH faster (very typically 30 times faster).
- Parameters
-
resource | $dstImage | |
resource | $srcImage | |
int | $dstX | |
int | $dstY | |
int | $srcX | |
int | $srcY | |
int | $dstW | |
int | $dstH | |
int | $srcW | |
int | $srcH | |
int | $quality | |
- Returns
- bool
◆ getData()
getData |
( |
|
$format = null , |
|
|
|
$quality = 80 |
|
) |
| |
Returns image data.
- Parameters
-
string | $format | returned image format MIME type (current image MIME type is used if not set) |
int | $quality | Image quality (used for JPG images only) |
- Returns
- string image data
◆ getDataSize()
Returns the size of the image data produced by the getData()
method.
- Returns
- int image data size in bytes
◆ getGDImage()
Returns GD image resource.
- Returns
- resource GD image resource
◆ getHeight()
Returns image height in pixels.
- Returns
- int image height
◆ getMimeType()
Returns image MIME type.
- Returns
- string MIME type
◆ getWidth()
Returns image width in pixels.
- Returns
- int image width
◆ hasValidGdImage()
Checks whether this object contains a valid GD image.
◆ isSupportedExtension()
static isSupportedExtension |
( |
|
$extension, |
|
|
|
$bmpSupport = false |
|
) |
| |
|
static |
Checks if a given exception is supported by the Image class.
- Parameters
-
string | $extension | |
bool | $bmpSupport | |
- Returns
- bool
◆ mimeTypeFromExtension()
static mimeTypeFromExtension |
( |
|
$extension | ) |
|
|
static |
Returns the MIME type for a given extension.
- Parameters
-
- Returns
- string MIME type
◆ parseSize()
static parseSize |
( |
|
$size | ) |
|
|
static |
Parses the image size from a string in the form of [width]x[height]
, for example 278x219.
- Parameters
-
- Returns
- array an array with width and height values array([width], [height]), for the example above: array(278, 219)
◆ resize()
resize |
( |
|
$maxWidth, |
|
|
|
$maxHeight, |
|
|
|
$quality = 80 , |
|
|
|
$useHigherFactor = false |
|
) |
| |
Resizes an image to a given size keeping the aspect ratio.
- Parameters
-
int | $maxWidth | maximum width |
int | $maxHeight | maximum height |
int | $quality | quality |
bool | $useHigherFactor | |
- Returns
- Image $this
◆ setMemory()
setMemory |
( |
|
$imageWidth, |
|
|
|
$imageHeight, |
|
|
|
$imageBits, |
|
|
|
$imageChannels |
|
) |
| |
The documentation for this class was generated from the following file: