Rev | Line | |
---|
[9852] | 1 | <?php |
---|
| 2 | /* |
---|
[9856] | 3 | Plugin Name: External ImageMagick |
---|
[9852] | 4 | Version: auto |
---|
[9856] | 5 | Description: Use external ImageMagick installation |
---|
[9852] | 6 | Plugin URI: auto |
---|
| 7 | Author: P@t |
---|
| 8 | Author URI: http://www.gauchon.com |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 12 | |
---|
| 13 | define('IMAGICK_EXEC_PATH' , PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)) . '/'); |
---|
| 14 | |
---|
| 15 | add_event_handler('get_admin_plugin_menu_links', 'imagick_exec_init'); |
---|
| 16 | add_event_handler('ws_add_methods', 'ws_add_method_load_imagick_exec_functions'); |
---|
| 17 | |
---|
| 18 | function imagick_exec_init($menu) |
---|
| 19 | { |
---|
| 20 | global $conf, $page; |
---|
| 21 | |
---|
| 22 | if (in_array($page['page'], array('intro','plugins_list','photos_add')) and !test_imagick_exec()) |
---|
| 23 | { |
---|
| 24 | array_push($page['warnings'], l10n('Unable to locate ImageMagick directory. Please fill $conf[\'imagick_directory\'] in your local configuration file.')); |
---|
| 25 | } |
---|
| 26 | elseif (($page['page'] == 'photos_add' or script_basename() == 'uploadify') and test_imagick_exec()) |
---|
| 27 | { |
---|
| 28 | include_once(IMAGICK_EXEC_PATH.'imagick.class.php'); |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | return $menu; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | function ws_add_method_load_imagick_exec_functions() |
---|
| 35 | { |
---|
| 36 | if (test_imagick_exec()) |
---|
| 37 | include_once(IMAGICK_EXEC_PATH.'imagick.class.php'); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | function test_imagick_exec() |
---|
| 41 | { |
---|
| 42 | global $conf; |
---|
| 43 | |
---|
[9860] | 44 | $imagick_dir = isset($conf['imagick_dir']) ? rtrim($conf['imagick_dir'], ' /\\').'/' : ''; |
---|
[9852] | 45 | @exec($imagick_dir.'convert', $returnarray, $returnvalue); |
---|
| 46 | return (!$returnvalue and !empty($returnarray[0]) and preg_match('/ImageMagick/', $returnarray[0])); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.