mujma: Added comments and method to retrieve image width and height. (merged from branches/gsoc)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41717 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
a038a20eb5
commit
85bd9b0460
|
@ -124,6 +124,14 @@ class GD extends Object {
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rotates image by given angle.
|
||||
*
|
||||
* @param angle
|
||||
|
||||
* @return GD
|
||||
*/
|
||||
|
||||
function rotate($angle) {
|
||||
if(!$this->gd) return;
|
||||
|
||||
|
@ -134,6 +142,17 @@ class GD extends Object {
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crop's part of image.
|
||||
*
|
||||
* @param top y position of left upper corner of crop rectangle
|
||||
* @param left x position of left upper corner of crop rectangle
|
||||
* @param width rectangle width
|
||||
* @param height rectangle height
|
||||
|
||||
* @return GD
|
||||
*/
|
||||
|
||||
function crop($top, $left, $width, $height) {
|
||||
$newGD = imagecreatetruecolor($width, $height);
|
||||
imagecopyresampled($newGD, $this->gd, 0, 0, $left, $top, $width, $height, $width, $height);
|
||||
|
@ -143,6 +162,25 @@ class GD extends Object {
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method return width of image.
|
||||
|
||||
* @return integer width.
|
||||
*/
|
||||
function getWidth() {
|
||||
return $this->width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method return height of image.
|
||||
|
||||
* @return integer height
|
||||
*/
|
||||
|
||||
function getHeight() {
|
||||
return $this->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize an image by width. Preserves aspect ratio.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue