[ Index ]

PHP Cross Reference of DokuWiki




/vendor/splitbrain/slika/src/ -> GdAdapter.php (summary)

(no description)

File Size: 445 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

GdAdapter:: (14 methods):

Class: GdAdapter  - X-Ref

Image processing adapter for PHP's libGD

__construct($imagepath, $options = [])   X-Ref
No description

__destruct()   X-Ref
Clean up

autorotate()   X-Ref
No description

rotate($orientation)   X-Ref

resize($width, $height)   X-Ref

crop($width, $height)   X-Ref

save($path, $extension = '')   X-Ref

loadImage($path)   X-Ref
Initialize libGD on the given image

return: resource
param: string $path

createImage($width, $height)   X-Ref
Creates a new blank image to which we can copy

Tries to set up alpha/transparency stuff correctly

return: resource
param: int $width
param: int $height

keepGifTransparency($image, $canvas)   X-Ref
Copy transparency from gif to gif

If no transparency is found or the PHP does not support it, the canvas is filled with white

return: void
param: resource $image Original image
param: resource $canvas New, empty image

boundingBox($width, $height)   X-Ref
Calculate new size

If widht and height are given, the new size will be fit within this bounding box.
If only one value is given the other is adjusted to match according to the aspect ratio

return: array (width, height)
param: int $width width of the bounding box
param: int $height height of the bounding box

cleanDimension($dim, $orig)   X-Ref
Ensure the given Dimension is a proper pixel value

When a percentage is given, the value is calculated based on the given original dimension

return: int
param: int|string $dim New Dimension
param: int $orig Original dimension

cropPosition($width, $height)   X-Ref
Calculates crop position

Given the wanted final size, this calculates which exact area needs to be cut
from the original image to be then resized to the wanted dimensions.

return: array (cropWidth, cropHeight, offsetX, offsetY)
param: int $width
param: int $height

resizeOperation($toWidth, $toHeight, $offsetX = 0, $offsetY = 0)   X-Ref
resize or crop images using PHP's libGD support

param: int $toWidth desired width
param: int $toHeight desired height
param: int $offsetX offset of crop centre
param: int $offsetY offset of crop centre