Plugin Directory

Changeset 408665


Ignore:
Timestamp:
07/12/2011 08:53:28 AM (15 years ago)
Author:
orangelab
Message:

Version 1.3.0

Location:
imagemagick-engine
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • imagemagick-engine/tags/1.3.0/imagemagick-engine.php

    r380081 r408665  
    66  Author: Orangelab
    77  Author URI: http://www.orangelab.se
    8   Version: 1.2.3
     8  Version: 1.3.0
    99  Text Domain: imagemagick-engine
    1010
     
    3030/*
    3131 * Current todo list:
    32  * - position of resize progressbar in Chrome
    3332 * - do not iterate through all images if only resizing non-ime images
    3433 *
     
    378377        $im->setImageCompressionQuality($quality);
    379378    }
    380     $im->setImageOpacity(1.0);
     379    if (method_exists($im, 'setImageOpacity'))
     380        $im->setImageOpacity(1.0);
    381381
    382382    if ($crop) {
     
    435435}
    436436
     437/*
     438 * Try to get realpath of path
     439 *
     440 * This won't work if there is open_basename restrictions.
     441 */
     442function ime_try_realpath($path) {
     443    $realpath = @realpath($path);
     444    if ($realpath)
     445        return $realpath;
     446    else
     447        return $path;
     448}
     449
    437450// Check if path leads to ImageMagick executable
    438451function ime_im_cli_check_command($path, $executable='convert') {
    439     $path = realpath($path);
    440     if (!is_dir($path))
    441         return null;
     452    $path = ime_try_realpath($path);
    442453
    443454    $cmd = $path . '/' . $executable;
     
    457468
    458469    foreach ($possible_paths AS $path) {
    459         /*
    460          * This operation would give a warning if path is restricted by
    461          * open_basedir.
    462          */
    463         $path = @realpath($path);
    464         if (!$path)
    465             continue;
    466470        if (ime_im_cli_check_command($path, $executable))
    467471            return $path;
     
    493497    $new_file = addslashes($new_file);
    494498
    495     $cmd = "\"$cmd\" -limit memory 150mb -limit map 128mb -size {$width}x{$height} \"{$old_file}\" -resize {$width}x{$height}";
     499    // limits are 150mb and 128mb
     500    $cmd = "\"$cmd\" -limit memory 157286400 -limit map 134217728 -size {$width}x{$height} \"{$old_file}\" -resize {$width}x{$height}";
    496501    if ($crop)
    497502        $cmd .= "^ -gravity center -extent {$width}x{$height}";
     503    else
     504        $cmd .= "!"; // force these dimensions
    498505
    499506    $quality = ime_get_option('quality', '-1');
     
    747754            ime_set_option('mode', $_POST['mode']);
    748755        if (isset($_POST['cli_path']))
    749             ime_set_option('cli_path', realpath($_POST['cli_path']));
     756            ime_set_option('cli_path', ime_try_realpath(trim($_POST['cli_path'])));
    750757        if (isset($_POST['quality'])) {
    751758            if (is_numeric($_POST['quality']))
     
    829836            <?php
    830837              foreach($sizes AS $s => $name) {
    831                   echo '<input type="checkbox" name="regen-size-' . $s . '" value="1" ' . ($handle_sizes[$s] ? ' CHECKED ' : '') . ' /> ' . $name . '<br />';
     838                  echo '<input type="checkbox" name="regen-size-' . $s . '" value="1" ' . (isset($handle_sizes[$s]) && $handle_sizes[$s] ? ' CHECKED ' : '') . ' /> ' . $name . '<br />';
    832839              }
    833840              ?>
     
    910917        <?php
    911918              foreach($sizes AS $s => $name) {
    912                   echo '<input type="checkbox" name="handle-' . $s . '" value="1" ' . ($handle_sizes[$s] ? ' CHECKED ' : '') . ' /> ' . $name . '<br />';
     919                  echo '<input type="checkbox" name="handle-' . $s . '" value="1" ' . (isset($handle_sizes[$s]) && $handle_sizes[$s] ? ' CHECKED ' : '') . ' /> ' . $name . '<br />';
    913920              }
    914921        ?>
  • imagemagick-engine/tags/1.3.0/js/ime-admin.js

    r332392 r408665  
    3131   
    3232    jQuery('#regenerate-images-metabox input').each(function(){
    33     if(jQuery(this).attr('name').substring(0,11) == "regen-size-" && jQuery(this).attr('checked')) {
    34         rt_sizes = rt_sizes + jQuery(this).attr('name').substring(11) + "|";
     33    var i = jQuery(this);
     34    var name = i.attr('name');
     35
     36    if(i.is(':checked') && name && name.substring(0,11) == "regen-size-") {
     37        rt_sizes = rt_sizes + name.substring(11) + "|";
    3538    }
    3639    });
    3740   
    38     if(jQuery('#force').attr('checked')) {
     41    if(jQuery('#force').is(':checked')) {
    3942    rt_force = 1;
    4043    }
     
    7275    var o = jQuery(this);
    7376    var mode = o.val();
    74     if (o.attr('selected'))
     77    if (o.is(':selected'))
    7578        jQuery('#ime-row-' + mode).show();
    7679    else
  • imagemagick-engine/tags/1.3.0/readme.txt

    r380081 r408665  
    33Tags: image, images, picture, imagemagick, gd
    44Requires at least: 2.9
    5 Tested up to: 3.1.2
    6 Stable tag: 1.2.3
     5Tested up to: 3.2
     6Stable tag: 1.3.0
    77
    88Improve the quality of re-sized images by replacing standard GD library with ImageMagick.
     
    7575== Changelog ==
    7676
     77= 1.3.0 =
     78* Tested agains WP 3.2
     79* Fix JS to be compatible with jQuery 1.6
     80* Remove some PHP notices
     81* Change command line limit values to specifik byte amounts (instead of "mb") for compatability with really old IM versions
     82* Handle open_basename restrictions better
     83* Handle older versions (pre 6.3.1) of PHP Imagick class
     84* IM and WordPress compute aspect ratio slightly differently, force the WP values
     85
    7786= 1.2.3 =
    7887* Fix bug in resize all images handling, also remove some PHP notices. Thanks to Andreas Kleinschmidt for the report
  • imagemagick-engine/trunk/imagemagick-engine.php

    r380081 r408665  
    66  Author: Orangelab
    77  Author URI: http://www.orangelab.se
    8   Version: 1.2.3
     8  Version: 1.3.0
    99  Text Domain: imagemagick-engine
    1010
     
    3030/*
    3131 * Current todo list:
    32  * - position of resize progressbar in Chrome
    3332 * - do not iterate through all images if only resizing non-ime images
    3433 *
     
    378377        $im->setImageCompressionQuality($quality);
    379378    }
    380     $im->setImageOpacity(1.0);
     379    if (method_exists($im, 'setImageOpacity'))
     380        $im->setImageOpacity(1.0);
    381381
    382382    if ($crop) {
     
    435435}
    436436
     437/*
     438 * Try to get realpath of path
     439 *
     440 * This won't work if there is open_basename restrictions.
     441 */
     442function ime_try_realpath($path) {
     443    $realpath = @realpath($path);
     444    if ($realpath)
     445        return $realpath;
     446    else
     447        return $path;
     448}
     449
    437450// Check if path leads to ImageMagick executable
    438451function ime_im_cli_check_command($path, $executable='convert') {
    439     $path = realpath($path);
    440     if (!is_dir($path))
    441         return null;
     452    $path = ime_try_realpath($path);
    442453
    443454    $cmd = $path . '/' . $executable;
     
    457468
    458469    foreach ($possible_paths AS $path) {
    459         /*
    460          * This operation would give a warning if path is restricted by
    461          * open_basedir.
    462          */
    463         $path = @realpath($path);
    464         if (!$path)
    465             continue;
    466470        if (ime_im_cli_check_command($path, $executable))
    467471            return $path;
     
    493497    $new_file = addslashes($new_file);
    494498
    495     $cmd = "\"$cmd\" -limit memory 150mb -limit map 128mb -size {$width}x{$height} \"{$old_file}\" -resize {$width}x{$height}";
     499    // limits are 150mb and 128mb
     500    $cmd = "\"$cmd\" -limit memory 157286400 -limit map 134217728 -size {$width}x{$height} \"{$old_file}\" -resize {$width}x{$height}";
    496501    if ($crop)
    497502        $cmd .= "^ -gravity center -extent {$width}x{$height}";
     503    else
     504        $cmd .= "!"; // force these dimensions
    498505
    499506    $quality = ime_get_option('quality', '-1');
     
    747754            ime_set_option('mode', $_POST['mode']);
    748755        if (isset($_POST['cli_path']))
    749             ime_set_option('cli_path', realpath($_POST['cli_path']));
     756            ime_set_option('cli_path', ime_try_realpath(trim($_POST['cli_path'])));
    750757        if (isset($_POST['quality'])) {
    751758            if (is_numeric($_POST['quality']))
     
    829836            <?php
    830837              foreach($sizes AS $s => $name) {
    831                   echo '<input type="checkbox" name="regen-size-' . $s . '" value="1" ' . ($handle_sizes[$s] ? ' CHECKED ' : '') . ' /> ' . $name . '<br />';
     838                  echo '<input type="checkbox" name="regen-size-' . $s . '" value="1" ' . (isset($handle_sizes[$s]) && $handle_sizes[$s] ? ' CHECKED ' : '') . ' /> ' . $name . '<br />';
    832839              }
    833840              ?>
     
    910917        <?php
    911918              foreach($sizes AS $s => $name) {
    912                   echo '<input type="checkbox" name="handle-' . $s . '" value="1" ' . ($handle_sizes[$s] ? ' CHECKED ' : '') . ' /> ' . $name . '<br />';
     919                  echo '<input type="checkbox" name="handle-' . $s . '" value="1" ' . (isset($handle_sizes[$s]) && $handle_sizes[$s] ? ' CHECKED ' : '') . ' /> ' . $name . '<br />';
    913920              }
    914921        ?>
  • imagemagick-engine/trunk/js/ime-admin.js

    r332392 r408665  
    3131   
    3232    jQuery('#regenerate-images-metabox input').each(function(){
    33     if(jQuery(this).attr('name').substring(0,11) == "regen-size-" && jQuery(this).attr('checked')) {
    34         rt_sizes = rt_sizes + jQuery(this).attr('name').substring(11) + "|";
     33    var i = jQuery(this);
     34    var name = i.attr('name');
     35
     36    if(i.is(':checked') && name && name.substring(0,11) == "regen-size-") {
     37        rt_sizes = rt_sizes + name.substring(11) + "|";
    3538    }
    3639    });
    3740   
    38     if(jQuery('#force').attr('checked')) {
     41    if(jQuery('#force').is(':checked')) {
    3942    rt_force = 1;
    4043    }
     
    7275    var o = jQuery(this);
    7376    var mode = o.val();
    74     if (o.attr('selected'))
     77    if (o.is(':selected'))
    7578        jQuery('#ime-row-' + mode).show();
    7679    else
  • imagemagick-engine/trunk/readme.txt

    r380081 r408665  
    33Tags: image, images, picture, imagemagick, gd
    44Requires at least: 2.9
    5 Tested up to: 3.1.2
    6 Stable tag: 1.2.3
     5Tested up to: 3.2
     6Stable tag: 1.3.0
    77
    88Improve the quality of re-sized images by replacing standard GD library with ImageMagick.
     
    7575== Changelog ==
    7676
     77= 1.3.0 =
     78* Tested agains WP 3.2
     79* Fix JS to be compatible with jQuery 1.6
     80* Remove some PHP notices
     81* Change command line limit values to specifik byte amounts (instead of "mb") for compatability with really old IM versions
     82* Handle open_basename restrictions better
     83* Handle older versions (pre 6.3.1) of PHP Imagick class
     84* IM and WordPress compute aspect ratio slightly differently, force the WP values
     85
    7786= 1.2.3 =
    7887* Fix bug in resize all images handling, also remove some PHP notices. Thanks to Andreas Kleinschmidt for the report
Note: See TracChangeset for help on using the changeset viewer.