WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Class Reference/WP Image Editor

Description

WP_Image_Editor is a class defined in wp-includes/class-wp-image-editor.php that is an abstract class, so it can't be called directly. It is used for implementations like WP_Image_Editor_GD and WP_Image_Editor_Imagick. It has some base functionality what can be used by those implementations.

You shouldn't call an implementation directly but use wp_get_image_editor() for that since that method looks which implementation is the best.

Interacting with WP_Image_Editor

Usage

$image = wp_get_image_editor( 'cool_image.jpg' ); // Return an implementation that extends <tt>WP_Image_Editor</tt>

if ( ! is_wp_error( $image ) ) {
    $image->rotate( 90 );
    $image->resize( 300, 300, true );
    $image->save( 'new_image.jpg' );
}

Methods and Properties

Properties

Methods

Filters

Source File

WP_Image_Editor() is located in wp-includes/class-wp-image-editor.php.

Resources

Related

Change Log