Show
Ignore:
Timestamp:
06/18/2008 01:21:06 PM (5 months ago)
Author:
Shadowhand
Message:

Added a $chmod param to Image::save()

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/libraries/Image.php

    r2667 r2858  
    284284         * 
    285285         * @throws  Kohana_Exception 
    286          * @param   string  new image filename 
    287          * @return  object 
    288          */ 
    289         public function save($new_image = FALSE) 
     286         * @param   string   new image filename 
     287         * @param   integer  permissions for new image 
     288         * @return  object 
     289         */ 
     290        public function save($new_image = FALSE, $chmod = 0644) 
    290291        { 
    291292                // If no new image is defined, use the current image 
     
    302303                        throw new Kohana_Exception('image.directory_unwritable', $dir); 
    303304 
    304                 // Process the image with the driver 
    305                 $status = $this->driver->process($this->image, $this->actions, $dir, $file); 
     305                if ($status = $this->driver->process($this->image, $this->actions, $dir, $file)) 
     306                { 
     307                        if ($chmod !== FALSE) 
     308                        { 
     309                                // Set permissions 
     310                                chmod($new_image, $chmod); 
     311                        } 
     312                } 
    306313 
    307314                // Reset the actions