Changeset 1852

Show
Ignore:
Timestamp:
01/28/2008 03:29:53 PM (12 months ago)
Author:
Shadowhand
Message:

Proper testing for GD2, without testing for imageconvolution(), which is not present in non-bundled GD. Fixes #343, thanks nrm.

Files:
1 modified

Legend:

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

    r1849 r1852  
    1111        { 
    1212                // Make sure that GD2 is available 
    13                 if ( ! function_exists('imageconvolution')) 
     13                if ( ! function_exists('gd_info')) 
     14                        throw new Kohana_Exception('image.gd.requires_v2'); 
     15 
     16                // Get the GD information 
     17                $info = gd_info(); 
     18 
     19                // Make sure that the GD2 is installed 
     20                if (strpos($info['GD Version'], '2.') === FALSE) 
    1421                        throw new Kohana_Exception('image.gd.requires_v2'); 
    1522        } 
     
    241248        public function sharpen($amount) 
    242249        { 
     250                // Make sure that the sharpening function is available 
     251                if ( ! function_exists('imageconvolution')) 
     252                        throw new Kohana_Exception('image.unsupported_method', __FUNCTION__); 
     253 
    243254                // Amount should be in the range of 18-10 
    244255                $amount = round(abs(-18 + ($amount * 0.08)), 2);