ImageEditor is a wrapper of gd functions.
How to start: Create from existing file or make an empty area
$image = ImageEditor::createFromFile($filename);
// or
$image = ImageEditor::createWithSize($width, $height);- width - width of image
- height - height of image
- resource - original gd-resource of image (you can pass it directly to image-gd functions)
- resize($width, $height) - resizes an image to
$widthX$height - zoomWidthTo($size) - decreases proportionally image width to
$size - zoomHeightTo($size) - decreases proportionally image height to
$size
- crop($x, $y, $x2, $y2) - cuts a rectangular piece of image
- cropSide($side, $size) - changes the size of
$side(top|bottom|left|right) to$size.
- appendImageTo($side, ImageEditor $appendix) - appends an image (
$appendix) to current image at$side(top|bottom|left|right). Warning: FunctionappendImageTois not finished! - placeImageAt($x, $y, ImageEditor $image) - places an image atop current image at
$xX$y. - placeImageAtCenter(ImageEditor $image) - places an image in the center of current image.
- rotate($angle, $bgColor) - rotates an image.
Warning: Function
rotateworks unpredictable!
saveToFile($filename, $format, $quality) - saves image to disk.
Possible $format values: jpeg, png.
Quality is an integer value between 0 (worst) and 100 (best).