Changeset f5a7e12 in github


Ignore:
Timestamp:
Mar 24, 2012 1:57:31 PM (15 months ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.8
Children:
cc46fb2
Parents:
b8ea160
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/include/rcube_image.php

    ra71a97f rf5a7e12  
    4141    public function props() 
    4242    { 
    43         $rcmail = rcmail::get_instance(); 
    44  
     43        // use GD extension 
    4544        if (function_exists('getimagesize') && ($imsize = @getimagesize($this->image_file))) { 
    4645            $width   = $imsize[0]; 
     
    5049        } 
    5150 
    52         if (!$type && ($cmd = $rcmail->config->get('im_identify_path', false))) { 
    53             $id = rcmail::exec($cmd. ' 2>/dev/null {in}', array('in' => $this->image_file)); 
    54             list(, $type, $size) = explode(' ', strtolower($id)); 
    55             if ($size) { 
    56                 list($width, $height) = explode('x', $size); 
    57             } 
     51        // use ImageMagick 
     52        if (!$type && ($data = $this->identify())) { 
     53            list($type, $width, $height) = $data; 
    5854        } 
    5955 
     
    6763        } 
    6864    } 
    69  
    7065 
    7166    /** 
     
    8277        $rcmail   = rcmail::get_instance(); 
    8378        $convert  = $rcmail->config->get('im_convert_path', false); 
    84         $identify = $rcmail->config->get('im_identify_path', false); 
    8579        $props    = $this->props(); 
    8680 
     
    9488            $p['in']   = $this->image_file; 
    9589            $p['size'] = $size.'x'.$size; 
    96             $p['type'] = $type = $props['type']; 
     90            $type      = $props['type']; 
    9791 
    98             if (!$type) { 
    99                 list(, $p['type']) = explode(' ', strtolower(rcmail::exec($identify . ' 2>/dev/null {in}', $p))); // for things like eps 
     92            if (!$type && ($data = $this->identify())) { 
     93                $type = $data[0]; 
    10094            } 
    10195 
     
    163157    } 
    164158 
     159    /** 
     160     * Identify command handler. 
     161     */ 
     162    private function identify() 
     163    { 
     164        $rcmail = rcmail::get_instance(); 
     165 
     166        if ($cmd = $rcmail->config->get('im_identify_path')) { 
     167            $args = array('in' => $this->image_file, 'format' => "%m %[fx:w] %[fx:h]"); 
     168            $id   = rcmail::exec($cmd. ' 2>/dev/null -format {format} {in}', $args); 
     169 
     170            if ($id) { 
     171                return explode(' ', strtolower($id)); 
     172            } 
     173        } 
     174    } 
    165175} 
Note: See TracChangeset for help on using the changeset viewer.