summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Guillemain <clement.guillemain@gmail.com>2012-10-11 06:09:26 -0700
committerClément Guillemain <clement.guillemain@gmail.com>2012-10-11 06:09:26 -0700
commit86763ab85dd1268f93562b6b9afba7eebf0498a6 (patch)
tree75cd64b1b97604d996da050f7cd0dc8147e381af
parenta016197b608dd6b9198b1754e1a75375d8874b8b (diff)
parent8aca9363933c375ac4d475bfb0b86466fb49da6e (diff)
downloadImageWorkshop-86763ab85dd1268f93562b6b9afba7eebf0498a6.zip
ImageWorkshop-86763ab85dd1268f93562b6b9afba7eebf0498a6.tar.gz
ImageWorkshop-86763ab85dd1268f93562b6b9afba7eebf0498a6.tar.bz2
Merge pull request #7 from FrenkyNet/fix-extending
Replaced self:: with static:: to allow for correct extending of the class
-rwxr-xr-xsrc/PHPImageWorkshop/ImageWorkshop.php46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/PHPImageWorkshop/ImageWorkshop.php b/src/PHPImageWorkshop/ImageWorkshop.php
index 2bffa4c..8addb6d 100755
--- a/src/PHPImageWorkshop/ImageWorkshop.php
+++ b/src/PHPImageWorkshop/ImageWorkshop.php
@@ -362,7 +362,7 @@ class ImageWorkshop
$layerTmpHeight = $totalHeightUnderLayer - $minLayerPositionY;
}
- $layerTmp = new self(array(
+ $layerTmp = new static(array(
"width" => $layerTmpWidth,
"height" => $layerTmpHeight,
));
@@ -378,7 +378,7 @@ class ImageWorkshop
} else {
- $layerTmp = new self(array(
+ $layerTmp = new static(array(
"imageVar" => $this->image,
));
@@ -679,7 +679,7 @@ class ImageWorkshop
*/
public static function generateImage($width = 100, $height = 100, $color = "ffffff", $opacity = 127)
{
- $RGBColors = self::convertHexToRGB($color);
+ $RGBColors = static::convertHexToRGB($color);
$image = imagecreatetruecolor($width, $height);
imagesavealpha($image, true);
@@ -784,7 +784,7 @@ class ImageWorkshop
if ($this->getWidth() != $newWidth || $this->getHeight() != $newHeight) {
- $layerTmp = new self(array(
+ $layerTmp = new static(array(
'width' => $newWidth,
'height' => $newHeight,
));
@@ -1026,13 +1026,13 @@ class ImageWorkshop
if (($width != $this->width || $positionX == 0) || ($height != $this->height || $positionY == 0)) {
- $layerTmp = new self(array(
+ $layerTmp = new static(array(
'width' => $width,
'height' => $height,
'backgroundColor' => $backgroundColor,
));
- $layerClone = new self(array(
+ $layerClone = new static(array(
'width' => $this->width,
'height' => $this->height,
));
@@ -1247,9 +1247,9 @@ class ImageWorkshop
}
}
- $transparentImage = self::generateImage($this->getWidth(), $this->getHeight());
+ $transparentImage = static::generateImage($this->getWidth(), $this->getHeight());
- self::imagecopymergealpha($transparentImage, $this->image, 0, 0, 0, 0, $this->getWidth(), $this->getHeight(), $opacity);
+ static::imagecopymergealpha($transparentImage, $this->image, 0, 0, 0, 0, $this->getWidth(), $this->getHeight(), $opacity);
unset($this->image);
$this->image = $transparentImage;
@@ -1268,7 +1268,7 @@ class ImageWorkshop
*/
public function writeText($text, $font = 1, $color = "ffffff", $positionX = 0, $positionY = 0, $align = "horizontal")
{
- $RGBTextColor = self::convertHexToRGB($color);
+ $RGBTextColor = static::convertHexToRGB($color);
$textColor = imagecolorallocate($this->image, $RGBTextColor["R"], $RGBTextColor["G"], $RGBTextColor["B"]);
if ($align == "horizontal") {
@@ -1297,7 +1297,7 @@ class ImageWorkshop
*/
public function write($text, $fontPath, $fontSize = 13, $color = "ffffff", $positionX = 0, $positionY = 0, $fontRotation = 0)
{
- $RGBTextColor = self::convertHexToRGB($color);
+ $RGBTextColor = static::convertHexToRGB($color);
$textColor = imagecolorallocate($this->image, $RGBTextColor["R"], $RGBTextColor["G"], $RGBTextColor["B"]);
return imagettftext($this->image, $fontSize, $fontRotation, $positionX, $positionY, $textColor, $fontPath, $text);
@@ -1326,8 +1326,8 @@ class ImageWorkshop
// Layer positions
if ($this->layerPositions[$layerId]["x"] != 0 || $this->layerPositions[$layerId]["y"] != 0) {
- $virginLayoutImageTmp = self::generateImage($this->width, $this->height);
- self::mergeTwoImages($virginLayoutImageTmp, $imagesToMerge[$layerLevel], $this->layerPositions[$layerId]["x"], $this->layerPositions[$layerId]["y"], 0, 0);
+ $virginLayoutImageTmp = static::generateImage($this->width, $this->height);
+ static::mergeTwoImages($virginLayoutImageTmp, $imagesToMerge[$layerLevel], $this->layerPositions[$layerId]["x"], $this->layerPositions[$layerId]["y"], 0, 0);
$imagesToMerge[$layerLevel] = $virginLayoutImageTmp;
unset($virginLayoutImageTmp);
}
@@ -1339,15 +1339,15 @@ class ImageWorkshop
foreach ($imagesToMerge as $imageLevel => $image) {
- self::mergeTwoImages($mergedImage, $image);
+ static::mergeTwoImages($mergedImage, $image);
$iterator++;
}
if ($backgroundColor) {
- $backgroundImage = self::generateImage($this->width, $this->height, $backgroundColor, 0);
- self::mergeTwoImages($backgroundImage, $mergedImage);
+ $backgroundImage = static::generateImage($this->width, $this->height, $backgroundColor, 0);
+ static::mergeTwoImages($backgroundImage, $mergedImage);
$mergedImage = $backgroundImage;
unset($backgroundImage);
}
@@ -1594,7 +1594,7 @@ class ImageWorkshop
$this->width = $newWidth;
$this->height = $newHeight;
- $virginLayoutImage = self::generateImage($this->width, $this->height);
+ $virginLayoutImage = static::generateImage($this->width, $this->height);
imagecopyresampled($virginLayoutImage, $this->image, 0, 0, 0, 0, $this->width, $this->height, $oldWidth, $oldHeight);
@@ -1613,11 +1613,11 @@ class ImageWorkshop
if ($backgroundColor) {
- $this->image = self::generateImage($this->width, $this->height, $backgroundColor, 0);
+ $this->image = static::generateImage($this->width, $this->height, $backgroundColor, 0);
} else {
- $this->image = self::generateImage($this->width, $this->height);
+ $this->image = static::generateImage($this->width, $this->height);
}
}
@@ -1706,11 +1706,11 @@ class ImageWorkshop
if ($backgroundColor) {
- $this->image = self::generateImage($this->width, $this->height, $backgroundColor, 0);
+ $this->image = static::generateImage($this->width, $this->height, $backgroundColor, 0);
} else {
- $this->image = self::generateImage($this->width, $this->height);
+ $this->image = static::generateImage($this->width, $this->height);
}
$this->write($text, $fontPath, $fontSize, $fontColor, $textDimensions["left"], $textDimensions["top"], $textRotation);
@@ -1741,7 +1741,7 @@ class ImageWorkshop
$this->layers[$layerId] = $layer;
// Add the layer positions in the main layer
- $this->layerPositions[$layerId] = self::calculatePositions($this->getWidth(), $this->getHeight(), $layer->getWidth(), $layer->getHeight(), $positionX, $positionY, $position);
+ $this->layerPositions[$layerId] = static::calculatePositions($this->getWidth(), $this->getHeight(), $layer->getWidth(), $layer->getHeight(), $positionX, $positionY, $position);
// Update the lastLayerId of the workshop
$this->lastLayerId = $layerId;
@@ -2023,9 +2023,9 @@ class ImageWorkshop
public function createNewVarFromBackgroundImage()
{
// Creation of a new background image
- $virginImage = self::generateImage($this->getWidth(), $this->getHeight());
+ $virginImage = static::generateImage($this->getWidth(), $this->getHeight());
- self::mergeTwoImages($virginImage, $this->image, 0, 0, 0, 0);
+ static::mergeTwoImages($virginImage, $this->image, 0, 0, 0, 0);
unset($this->image);
$this->image = $virginImage;