[wp-trac] [WordPress Trac] #6821: ImageMagick support
WordPress Trac
wp-trac at lists.automattic.com
Fri Jul 27 22:39:58 UTC 2012
#6821: ImageMagick support
----------------------------+-------------------------
Reporter: matt | Owner: tellyworth
Type: task (blessed) | Status: new
Priority: normal | Milestone: 3.5
Component: Upload | Version: 2.5
Severity: normal | Resolution:
Keywords: |
----------------------------+-------------------------
Comment (by scribu):
Had a chat in IRC with TomAuger, DH-Shredder and MarkoHeijnen about the
class architecture.
Here's my suggestion:
{{{
interface WP_Image_Editor {
function __construct( $file_path );
function resize( ... );
function rotate( ... );
function save( ... );
}
class WP_Image_Editor_IM implements WP_Image_Editor {
...
}
class WP_Image_Editor_GD implements WP_Image_Editor {
...
}
function wp_get_image_for_editing( $file_path ) {
// check file path
$class = function_exists( ... ) ? 'WP_Image_IM' : 'WP_Image_GD';
return new $class( $file_path );
}
}}}
Usage example:
{{{
$image = wp_get_image_for_editing( $file_path );
$image->resize( $w, $h );
$image->save();
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/6821#comment:20>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list