mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
mujma: Added functions for crop and rotate images. (merged from branches/gsoc)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@41716 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
fcf8302bba
commit
a038a20eb5
@ -124,6 +124,25 @@ class GD extends Object {
|
||||
return $output;
|
||||
}
|
||||
|
||||
function rotate($angle) {
|
||||
if(!$this->gd) return;
|
||||
|
||||
$newGD = imagerotate($this->gd, $angle,0);
|
||||
|
||||
$output = new GD();
|
||||
$output->setGD($newGD);
|
||||
return $output;
|
||||
}
|
||||
|
||||
function crop($top, $left, $width, $height) {
|
||||
$newGD = imagecreatetruecolor($width, $height);
|
||||
imagecopyresampled($newGD, $this->gd, 0, 0, $left, $top, $width, $height, $width, $height);
|
||||
|
||||
$output = new GD();
|
||||
$output->setGD($newGD);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize an image by width. Preserves aspect ratio.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user