[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

(no description)

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

Defines 1 class

GdAdapter:: (13 methods):
  __construct()
  __destruct()
  autorotate()
  rotate()
  resize()
  crop()
  save()
  loadImage()
  createImage()
  boundingBox()
  cleanDimension()
  cropPosition()
  resizeOperation()


Class: GdAdapter  - X-Ref

__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

param: string $path
return: resource

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

Tries to set up alpha/transparency stuff correctly

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

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

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

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

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

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.

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

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