Update modified to Kohana r3823 (svn merge -c19322 vendor/kohana/modified/kohana trunk/kohana)

This commit is contained in:
Bharat Mediratta
2008-12-20 07:38:46 +00:00
parent ad0ddc236c
commit 64f993db6f
8 changed files with 130 additions and 94 deletions
+33 -29
View File
@@ -303,9 +303,10 @@ class Image_Core {
* @throws Kohana_Exception
* @param string new image filename
* @param integer permissions for new image
* @param boolean keep or discard image process actions
* @return object
*/
public function save($new_image = FALSE, $chmod = 0644)
public function save($new_image = FALSE, $chmod = 0644, $keep_actions = FALSE)
{
// If no new image is defined, use the current image
empty($new_image) and $new_image = $this->image['file'];
@@ -328,37 +329,40 @@ class Image_Core {
chmod($new_image, $chmod);
}
}
// Reset the actions
$this->actions = array();
// Reset actions. Subsequent save() or render() will not apply previous actions.
if ($keep_actions === FALSE)
$this->actions = array();
return $status;
}
/**
* Output the image to the browser.
*
* @return object
*/
public function render()
{
$new_image = $this->image['file'];
// Separate the directory and filename
$dir = pathinfo($new_image, PATHINFO_DIRNAME);
$file = pathinfo($new_image, PATHINFO_BASENAME);
// Normalize the path
$dir = str_replace('\\', '/', realpath($dir)).'/';
// Process the image with the driver
$status = $this->driver->process($this->image, $this->actions, $dir, $file, $render = TRUE);
// Reset the actions
$this->actions = array();
return $status;
}
/**
* Output the image to the browser.
*
* @param boolean keep or discard image process actions
* @return object
*/
public function render($keep_actions = FALSE)
{
$new_image = $this->image['file'];
// Separate the directory and filename
$dir = pathinfo($new_image, PATHINFO_DIRNAME);
$file = pathinfo($new_image, PATHINFO_BASENAME);
// Normalize the path
$dir = str_replace('\\', '/', realpath($dir)).'/';
// Process the image with the driver
$status = $this->driver->process($this->image, $this->actions, $dir, $file, $render = TRUE);
// Reset actions. Subsequent save() or render() will not apply previous actions.
if ($keep_actions === FALSE)
$this->actions = array();
return $status;
}
/**
* Sanitize a given value type.