Languages: English • 日本語 (Add your language)
This function is the main function that you use when you want to get a reference to an image, to edit a local image on the server. It returns a WP_Image_Editor instance and loads a file into it. With that you can manipulate an image by calling methods on it. For more information see: WP_Image_Editor. Keep in mind that the GD library needs to be installed and active on your server to use the full range of the image editor features.
<?php wp_get_image_editor( $path, $args ); ?>
$image = wp_get_image_editor( 'cool_image.jpg' ); if ( ! is_wp_error( $image ) ) { $image->rotate( 90 ); $image->resize( 300, 300, true ); $image->save( 'new_image.jpg' ); }
wp_get_image_editor() is located in wp-includes/media.php