aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-04-29 17:10:00 +0000
committerpatdenice <patdenice@piwigo.org>2011-04-29 17:10:00 +0000
commit90825d08ea8c6af10aadc2067cf8fbf125c8a29f (patch)
tree4526c7594bd9ce3d9d4f0c47ae5af406fc7e75b1
parent920f8b443a300d2d2fa429b8188efec10314dd97 (diff)
feature:2284
Rename $conf['image_library'] into $conf['graphics_library'] Display library used in admin intro page. git-svn-id: http://piwigo.org/svn/trunk@10684 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/image.class.php77
-rw-r--r--admin/intro.php31
-rw-r--r--admin/photos_add_settings.php2
-rw-r--r--admin/themes/default/template/intro.tpl3
-rw-r--r--language/en_UK/admin.lang.php1
-rw-r--r--language/fr_FR/admin.lang.php1
-rw-r--r--ws.php2
7 files changed, 79 insertions, 38 deletions
diff --git a/admin/include/image.class.php b/admin/include/image.class.php
index 943c2a257..0fa851636 100644
--- a/admin/include/image.class.php
+++ b/admin/include/image.class.php
@@ -57,8 +57,6 @@ class pwg_image
function __construct($source_filepath, $library=null)
{
- global $conf;
-
$this->source_filepath = $source_filepath;
trigger_action('load_image_library', array(&$this) );
@@ -75,40 +73,9 @@ class pwg_image
die('[Image] unsupported file extension');
}
- if (is_null($library))
+ if (!($this->library = self::get_library($library, $extension)))
{
- $library = $conf['image_library'];
- }
-
- // Choose image library
- switch (strtolower($library))
- {
- case 'auto':
- case 'imagick':
- if ($extension != 'gif' and self::is_imagick())
- {
- $this->library = 'imagick';
- break;
- }
- case 'ext_imagick':
- if ($extension != 'gif' and self::is_ext_imagick())
- {
- $this->library = 'ext_imagick';
- break;
- }
- case 'gd':
- if (self::is_gd())
- {
- $this->library = 'gd';
- break;
- }
- default:
- if ($library != 'auto')
- {
- // Requested library not available. Try another library
- return self::__construct($source_filepath, 'auto');
- }
- die('No image library available on your server.');
+ die('No image library available on your server.');
}
$class = 'image_'.$this->library;
@@ -304,7 +271,7 @@ class pwg_image
{
return false;
}
- @exec($conf['ext_imagick_dir'].'convert', $returnarray, $returnvalue);
+ @exec($conf['ext_imagick_dir'].'convert -version', $returnarray, $returnvalue);
if (!$returnvalue and !empty($returnarray[0]) and preg_match('/ImageMagick/i', $returnarray[0]))
{
return true;
@@ -317,6 +284,44 @@ class pwg_image
return function_exists('gd_info');
}
+ static function get_library($library=null, $extension=null)
+ {
+ global $conf;
+
+ if (is_null($library))
+ {
+ $library = $conf['image_library'];
+ }
+
+ // Choose image library
+ switch (strtolower($library))
+ {
+ case 'auto':
+ case 'imagick':
+ if ($extension != 'gif' and self::is_imagick())
+ {
+ return 'imagick';
+ }
+ case 'ext_imagick':
+ if ($extension != 'gif' and self::is_ext_imagick())
+ {
+ return 'ext_imagick';
+ }
+ case 'gd':
+ if (self::is_gd())
+ {
+ return 'gd';
+ }
+ default:
+ if ($library != 'auto')
+ {
+ // Requested library not available. Try another library
+ return self::get_library('auto');
+ }
+ }
+ return false;
+ }
+
function destroy()
{
if (method_exists($this->image, 'destroy'))
diff --git a/admin/intro.php b/admin/intro.php
index 09b7e0811..7b6985e6f 100644
--- a/admin/intro.php
+++ b/admin/intro.php
@@ -29,6 +29,7 @@ if (!defined('PHPWG_ROOT_PATH'))
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
include_once(PHPWG_ROOT_PATH.'admin/include/check_integrity.class.php');
include_once(PHPWG_ROOT_PATH.'admin/include/c13y_internal.class.php');
+include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');
// +-----------------------------------------------------------------------+
// | Check Access and exit when user status is not ok |
@@ -258,6 +259,36 @@ if ($nb_comments > 0)
);
}
+// graphics library
+switch (pwg_image::get_library())
+{
+ case 'imagick':
+ $library = 'ImageMagick';
+ $img = new Imagick();
+ $version = $img->getVersion();
+ if (preg_match('/ImageMagick \d+\.\d+\.\d+-?\d*/', $version['versionString'], $match))
+ {
+ $library = $match[0];
+ }
+ $template->assign('GRAPHICS_LIBRARY', $library);
+ break;
+
+ case 'ext_imagick':
+ $library = 'External ImageMagick';
+ exec($conf['ext_imagick_dir'].'convert -version', $returnarray);
+ if (preg_match('/Version: ImageMagick (\d+\.\d+\.\d+-?\d*)/', $returnarray[0], $match))
+ {
+ $library .= ' ' . $match[1];
+ }
+ $template->assign('GRAPHICS_LIBRARY', $library);
+ break;
+
+ case 'gd':
+ $gd_info = gd_info();
+ $template->assign('GRAPHICS_LIBRARY', 'GD '.@$gd_info['GD Version']);
+ break;
+}
+
// +-----------------------------------------------------------------------+
// | sending html code |
// +-----------------------------------------------------------------------+
diff --git a/admin/photos_add_settings.php b/admin/photos_add_settings.php
index 91ac9cbd9..eebbec15c 100644
--- a/admin/photos_add_settings.php
+++ b/admin/photos_add_settings.php
@@ -111,7 +111,7 @@ foreach (array_keys($upload_form_config) as $field)
$template->assign(
array(
'F_ADD_ACTION'=> PHOTOS_ADD_BASE_URL,
- 'MANAGE_HD' => (pwg_image::is_imagick() or pwg_image::is_ext_imagick()),
+ 'MANAGE_HD' => pwg_image::get_library() != 'gd',
'values' => $form_values
)
);
diff --git a/admin/themes/default/template/intro.tpl b/admin/themes/default/template/intro.tpl
index 0f4dc7c00..6bdbfc9ff 100644
--- a/admin/themes/default/template/intro.tpl
+++ b/admin/themes/default/template/intro.tpl
@@ -53,6 +53,9 @@ jQuery().ready(function(){
<li>{'Operating system'|@translate}: {$OS}</li>
<li>PHP: {$PHP_VERSION} (<a href="{$U_PHPINFO}" class="externalLink">{'Show info'|@translate}</a>) [{$PHP_DATATIME}]</li>
<li>{$DB_ENGINE}: {$DB_VERSION} [{$DB_DATATIME}]</li>
+ {if isset($GRAPHICS_LIBRARY)}
+ <li>{'Graphics Library'|@translate}: {$GRAPHICS_LIBRARY}</li>
+ {/if}
</ul>
</dd>
diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php
index 842b29c33..f83f26902 100644
--- a/language/en_UK/admin.lang.php
+++ b/language/en_UK/admin.lang.php
@@ -830,4 +830,5 @@ $lang['Width'] = 'Width';
$lang['Height'] = 'Height';
$lang['Follow Orientation'] = 'Follow Orientation';
$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>.';
+$lang['Graphics Library'] = 'Graphics Library';
?> \ No newline at end of file
diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php
index ed139318a..f67102ab2 100644
--- a/language/fr_FR/admin.lang.php
+++ b/language/fr_FR/admin.lang.php
@@ -841,4 +841,5 @@ $lang['Width'] = 'Largeur';
$lang['Height'] = 'Hauteur';
$lang['Follow Orientation'] = "Respecter l'orientation";
$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>.';
+$lang['Graphics Library'] = 'Bibliothèque graphique';
?> \ No newline at end of file
diff --git a/ws.php b/ws.php
index 96e5949b0..a328c94f0 100644
--- a/ws.php
+++ b/ws.php
@@ -412,7 +412,7 @@ function ws_addDefaultMethods( $arr )
'image_path' => array('default' => null),
'type' => array('default' => 'thumbnail'),
'automatic_rotation' => array('default' => $conf['upload_form_automatic_rotation']),
- 'library' => array('default' => $conf['image_library']),
+ 'library' => array('default' => $conf['graphics_library']),
'maxwidth' => array('default' => null),
'maxheight' => array('default' => null),
'crop' => array('default' => null),