Ticket #597: GD.diff

File GD.diff, 1.2 kB (added by tterragcnoom, 7 months ago)

system/libraries/drivers/Image/GD.php

  • (a) GD.php vs. (b) (clipboard)

    a b  
    3030                        throw new Kohana_Exception('image.gd.requires_v2'); 
    3131        } 
    3232 
    33         public function process($image, $actions, $dir, $file) 
     33        public function process($image, $actions, $dir, $file, $output = FALSE) 
    3434        { 
    3535                // Set the "create" function 
    3636                switch ($image['type']) 
     
    101101                                break; 
    102102                        } 
    103103 
    104                         // Set the status to the save return value, saving with the quality reques 
    105                         $status = isset($quality) ? $save($this->tmp_image, $dir.$file, $quality) : $save($this->tmp_image, $dir.$file); 
     104                        if ($output == FALSE){ 
     105                                // Set the status to the save return value, saving with the quality requested 
     106                                $status = isset($quality) ? $save($this->tmp_image, $dir.$file, $quality) : $save($this->tmp_image, $dir.$file); 
     107                        }else{ 
     108                                switch ($save){ 
     109                                        case 'imagejpeg': 
     110                                                header ("Content-Type: image/jpeg"); 
     111                                        break; 
     112                                        case 'imagegif': 
     113                                                header ("Content-Type: image/gif"); 
     114                                        break; 
     115                                        case 'imagepng': 
     116                                                header ("Content-Type: image/png"); 
     117                                        break; 
     118                                } 
     119                                $status = isset($quality) ? $save($this->tmp_image, null, $quality) : $save($this->tmp_image); 
     120                        } 
    106121 
    107122                        // Destroy the temporary image 
    108123                        imagedestroy($this->tmp_image);