Permalink
Browse files

Merge branch '3.1/release/3.1.2' into 3.1/master

  • Loading branch information...
2 parents 697c986 + 64f6df1 commit f1d84ee37cda3a824e62548c5ec07ddd9cac01ee @zombor zombor committed Mar 13, 2011
Showing with 10 additions and 8 deletions.
  1. +5 −5 classes/kohana/image.php
  2. +5 −3 classes/kohana/image/gd.php
@@ -10,7 +10,7 @@
*/
abstract class Kohana_Image {
- // Resizing contraints
+ // Resizing constraints
const NONE = 0x01;
const WIDTH = 0x02;
const HEIGHT = 0x03;
@@ -137,7 +137,7 @@ public function __toString()
if (is_object(Kohana::$log))
{
// Get the text of the exception
- $error = Kohana::exception_text($e);
+ $error = Kohana_Exception::text($e);
// Add this exception to the log
Kohana::$log->add(Log::ERROR, $error);
@@ -180,20 +180,20 @@ public function resize($width = NULL, $height = NULL, $master = NULL)
// Choose the master dimension automatically
$master = Image::AUTO;
}
- // Image::WIDTH and Image::HEIGHT depricated. You can use it in old projects,
+ // Image::WIDTH and Image::HEIGHT deprecated. You can use it in old projects,
// but in new you must pass empty value for non-master dimension
elseif ($master == Image::WIDTH AND ! empty($width))
{
$master = Image::AUTO;
- // Set empty height for backvard compatibility
+ // Set empty height for backward compatibility
$height = NULL;
}
elseif ($master == Image::HEIGHT AND ! empty($height))
{
$master = Image::AUTO;
- // Set empty width for backvard compatibility
+ // Set empty width for backward compatibility
$width = NULL;
}
@@ -408,6 +408,8 @@ protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacit
// Create the watermark image resource
$overlay = imagecreatefromstring($watermark->render());
+ imagesavealpha($overlay, TRUE);
+
// Get the width and height of the watermark
$width = imagesx($overlay);
$height = imagesy($overlay);
@@ -417,13 +419,13 @@ protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacit
// Convert an opacity range of 0-100 to 127-0
$opacity = round(abs(($opacity * 127 / 100) - 127));
- // Allocate transparent white
- $color = imagecolorallocatealpha($overlay, 255, 255, 255, $opacity);
+ // Allocate transparent gray
+ $color = imagecolorallocatealpha($overlay, 127, 127, 127, $opacity);
// The transparent image will overlay the watermark
imagelayereffect($overlay, IMG_EFFECT_OVERLAY);
- // Fill the background with transparent white
+ // Fill the background with the transparent color
imagefilledrectangle($overlay, 0, 0, $width, $height, $color);
}

0 comments on commit f1d84ee

Please sign in to comment.