Changeset 10684


Ignore:
Timestamp:
Apr 29, 2011, 7:10:00 PM (13 years ago)
Author:
patdenice
Message:

feature:2284
Rename $confimage_library into $confgraphics_library
Display library used in admin intro page.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/image.class.php

    r10641 r10684  
    5858  function __construct($source_filepath, $library=null)
    5959  {
    60     global $conf;
    61 
    6260    $this->source_filepath = $source_filepath;
    6361
     
    7674    }
    7775
    78     if (is_null($library))
    79     {
    80       $library = $conf['image_library'];
    81     }
    82 
    83     // Choose image library
    84     switch (strtolower($library))
    85     {
    86       case 'auto':
    87       case 'imagick':
    88         if ($extension != 'gif' and self::is_imagick())
    89         {
    90           $this->library = 'imagick';
    91           break;
    92         }
    93       case 'ext_imagick':
    94         if ($extension != 'gif' and self::is_ext_imagick())
    95         {
    96           $this->library = 'ext_imagick';
    97           break;
    98         }
    99       case 'gd':
    100         if (self::is_gd())
    101         {
    102           $this->library = 'gd';
    103           break;
    104         }
    105       default:
    106         if ($library != 'auto')
    107         {
    108           // Requested library not available. Try another library
    109           return self::__construct($source_filepath, 'auto');
    110         }
    111         die('No image library available on your server.');
     76    if (!($this->library = self::get_library($library, $extension)))
     77    {
     78      die('No image library available on your server.');
    11279    }
    11380
     
    305272      return false;
    306273    }
    307     @exec($conf['ext_imagick_dir'].'convert', $returnarray, $returnvalue);
     274    @exec($conf['ext_imagick_dir'].'convert -version', $returnarray, $returnvalue);
    308275    if (!$returnvalue and !empty($returnarray[0]) and preg_match('/ImageMagick/i', $returnarray[0]))
    309276    {
     
    316283  {
    317284    return function_exists('gd_info');
     285  }
     286
     287  static function get_library($library=null, $extension=null)
     288  {
     289    global $conf;
     290
     291    if (is_null($library))
     292    {
     293      $library = $conf['image_library'];
     294    }
     295
     296    // Choose image library
     297    switch (strtolower($library))
     298    {
     299      case 'auto':
     300      case 'imagick':
     301        if ($extension != 'gif' and self::is_imagick())
     302        {
     303          return 'imagick';
     304        }
     305      case 'ext_imagick':
     306        if ($extension != 'gif' and self::is_ext_imagick())
     307        {
     308          return 'ext_imagick';
     309        }
     310      case 'gd':
     311        if (self::is_gd())
     312        {
     313          return 'gd';
     314        }
     315      default:
     316        if ($library != 'auto')
     317        {
     318          // Requested library not available. Try another library
     319          return self::get_library('auto');
     320        }
     321    }
     322    return false;
    318323  }
    319324
  • trunk/admin/intro.php

    r8728 r10684  
    3030include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
    3131include_once(PHPWG_ROOT_PATH.'admin/include/c13y_internal.class.php');
     32include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');
    3233
    3334// +-----------------------------------------------------------------------+
     
    259260}
    260261
     262// graphics library
     263switch (pwg_image::get_library())
     264{
     265  case 'imagick':
     266    $library = 'ImageMagick';
     267    $img = new Imagick();
     268    $version = $img->getVersion();
     269    if (preg_match('/ImageMagick \d+\.\d+\.\d+-?\d*/', $version['versionString'], $match))
     270    {
     271      $library = $match[0];
     272    }
     273    $template->assign('GRAPHICS_LIBRARY', $library);
     274    break;
     275
     276  case 'ext_imagick':
     277    $library = 'External ImageMagick';
     278    exec($conf['ext_imagick_dir'].'convert -version', $returnarray);
     279    if (preg_match('/Version: ImageMagick (\d+\.\d+\.\d+-?\d*)/', $returnarray[0], $match))
     280    {
     281      $library .= ' ' . $match[1];
     282    }
     283    $template->assign('GRAPHICS_LIBRARY', $library);
     284    break;
     285
     286  case 'gd':
     287    $gd_info = gd_info();
     288    $template->assign('GRAPHICS_LIBRARY', 'GD '.@$gd_info['GD Version']);
     289    break;
     290}
     291
    261292// +-----------------------------------------------------------------------+
    262293// |                           sending html code                           |
  • trunk/admin/photos_add_settings.php

    r10641 r10684  
    112112    array(
    113113      'F_ADD_ACTION'=> PHOTOS_ADD_BASE_URL,
    114       'MANAGE_HD' => (pwg_image::is_imagick() or pwg_image::is_ext_imagick()),
     114      'MANAGE_HD' => pwg_image::get_library() != 'gd',
    115115      'values' => $form_values
    116116    )
  • trunk/admin/themes/default/template/intro.tpl

    r10538 r10684  
    5454      <li>PHP: {$PHP_VERSION} (<a href="{$U_PHPINFO}" class="externalLink">{'Show info'|@translate}</a>)  [{$PHP_DATATIME}]</li>
    5555      <li>{$DB_ENGINE}: {$DB_VERSION} [{$DB_DATATIME}]</li>
     56      {if isset($GRAPHICS_LIBRARY)}
     57      <li>{'Graphics Library'|@translate}: {$GRAPHICS_LIBRARY}</li>
     58      {/if}
    5659    </ul>
    5760  </dd>
  • trunk/language/en_UK/admin.lang.php

    r10571 r10684  
    831831$lang['Follow Orientation'] = 'Follow Orientation';
    832832$lang['If you want to regenerate thumbnails, please go to the <a href="%s">Batch Manager</a>.'] = 'If you want to regenerate thumbnails, please go to the <a href="%s">Batch Manager</a>.';
     833$lang['Graphics Library'] = 'Graphics Library';
    833834?>
  • trunk/language/fr_FR/admin.lang.php

    r10571 r10684  
    842842$lang['Follow Orientation'] = "Respecter l'orientation";
    843843$lang['If you want to regenerate thumbnails, please go to the <a href="%s">Batch Manager</a>.'] = 'Si vous voulez régénérer des miniatures, merci de vous rendre dans la <a href="%s">Gestion par lot</a>.';
     844$lang['Graphics Library'] = 'Bibliothèque graphique';
    844845?>
  • trunk/ws.php

    r10641 r10684  
    413413      'type' => array('default' => 'thumbnail'),
    414414      'automatic_rotation' => array('default' => $conf['upload_form_automatic_rotation']),
    415       'library' => array('default' => $conf['image_library']),
     415      'library' => array('default' => $conf['graphics_library']),
    416416      'maxwidth' => array('default' => null),
    417417      'maxheight' => array('default' => null),
Note: See TracChangeset for help on using the changeset viewer.