Upgrade to KH 3.1.3.1
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
abstract class Kohana_Image {
|
||||
|
||||
// Resizing contraints
|
||||
// Resizing constraints
|
||||
const NONE = 0x01;
|
||||
const WIDTH = 0x02;
|
||||
const HEIGHT = 0x03;
|
||||
@@ -73,6 +73,11 @@ abstract class Kohana_Image {
|
||||
*/
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var string mime type of the image
|
||||
*/
|
||||
public $mime;
|
||||
|
||||
/**
|
||||
* Loads information about the image. Will throw an exception if the image
|
||||
* does not exist or is not an image.
|
||||
@@ -99,7 +104,7 @@ abstract class Kohana_Image {
|
||||
if (empty($file) OR empty($info))
|
||||
{
|
||||
throw new Kohana_Exception('Not an image or invalid image: :file',
|
||||
array(':file' => Kohana::debug_path($file)));
|
||||
array(':file' => Debug::path($file)));
|
||||
}
|
||||
|
||||
// Store the image information
|
||||
@@ -132,10 +137,10 @@ abstract class Kohana_Image {
|
||||
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(Kohana::ERROR, $error);
|
||||
Kohana::$log->add(Log::ERROR, $error);
|
||||
}
|
||||
|
||||
// Showing any kind of error will be "inside" image data
|
||||
@@ -175,20 +180,20 @@ abstract class Kohana_Image {
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -599,7 +604,7 @@ abstract class Kohana_Image {
|
||||
if ( ! is_writable($file))
|
||||
{
|
||||
throw new Kohana_Exception('File must be writable: :file',
|
||||
array(':file' => Kohana::debug_path($file)));
|
||||
array(':file' => Debug::path($file)));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -610,7 +615,7 @@ abstract class Kohana_Image {
|
||||
if ( ! is_dir($directory) OR ! is_writable($directory))
|
||||
{
|
||||
throw new Kohana_Exception('Directory must be writable: :directory',
|
||||
array(':directory' => Kohana::debug_path($directory)));
|
||||
array(':directory' => Debug::path($directory)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -408,6 +408,8 @@ class Kohana_Image_GD extends Image {
|
||||
// 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 @@ class Kohana_Image_GD extends Image {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
23
includes/kohana/modules/image/config/userguide.php
Normal file
23
includes/kohana/modules/image/config/userguide.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php defined('SYSPATH') or die('No direct script access.');
|
||||
|
||||
return array(
|
||||
// Leave this alone
|
||||
'modules' => array(
|
||||
|
||||
// This should be the path to this modules userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename'
|
||||
'image' => array(
|
||||
|
||||
// Whether this modules userguide pages should be shown
|
||||
'enabled' => TRUE,
|
||||
|
||||
// The name that should show up on the userguide index page
|
||||
'name' => 'Image',
|
||||
|
||||
// A short description of this module, shown on the index page
|
||||
'description' => 'Image manipulation.',
|
||||
|
||||
// Copyright message, shown in the footer for this module
|
||||
'copyright' => '© 2008–2010 Kohana Team',
|
||||
)
|
||||
)
|
||||
);
|
0
includes/kohana/modules/image/guide/image/index.md
Normal file
0
includes/kohana/modules/image/guide/image/index.md
Normal file
3
includes/kohana/modules/image/guide/image/menu.md
Normal file
3
includes/kohana/modules/image/guide/image/menu.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## [Image]()
|
||||
- [Using](using)
|
||||
- [Examples](examples)
|
0
includes/kohana/modules/image/guide/image/using.md
Normal file
0
includes/kohana/modules/image/guide/image/using.md
Normal file
Reference in New Issue
Block a user