[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

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

(no description)

File Size: 392 lines (12 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()
  keepGifTransparency()
  cropPosition()
  centerOffset()
  resizeOperation()


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, $upscale = true)   X-Ref


crop($width, $height, $upscale = true)   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

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

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

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.

The dimensions are expected to be already resolved to non-zero pixel values.

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

centerOffset($cropWidth, $cropHeight)   X-Ref
Calculate the top left offset to extract a centered region of the given size

param: int $cropWidth width of the region to extract
param: int $cropHeight height of the region to extract
return: array (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