Changeset 22849
- Timestamp:
- 11/26/2012 10:40:34 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-image-editor-imagick.php
r22817 r22849 39 39 */ 40 40 public static function test( $args = array() ) { 41 if ( ! extension_loaded( 'imagick' ) || ! is_callable( 'Imagick', 'queryFormats' ) ) 41 42 $required_methods = array( 43 'clear', 44 'destroy', 45 'valid', 46 'getimage', 47 'writeimage', 48 'getimageblob', 49 'getimagegeometry', 50 'getimageformat', 51 'setimageformat', 52 'setimagecompression', 53 'setimagecompressionquality', 54 'setimagepage', 55 'scaleimage', 56 'cropimage', 57 'rotateimage', 58 'flipimage', 59 'flopimage', 60 ); 61 62 // Check for requirements 63 if ( ! extension_loaded( 'imagick' ) || 64 ! class_exists( 'Imagick' ) || 65 ! is_callable( 'Imagick', 'queryFormats' ) || 66 ! class_exists( 'ImagickPixel' ) || 67 ! defined( 'imagick::COMPRESSION_JPEG' ) || 68 array_diff( $required_methods, get_class_methods( 'Imagick' ) ) ) { 69 42 70 return false; 71 } 72 73 /** 74 * setIteratorIndex is optional unless mime is an animated format. 75 * Here, we just say no if a user is attempting to 76 * edit a GIF and setIteratorIndex isn't available. 77 */ 78 if ( ( ! isset( $args['mime_type'] ) || $args['mime_type'] == 'image/gif' ) && 79 ! method_exists( 'Imagick', 'setIteratorIndex' ) ) { 80 81 return false; 82 } 43 83 44 84 return true; … … 89 129 return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file); 90 130 91 // Select the first frame to handle animated GIFs properly 92 $this->image->setIteratorIndex(0); 131 // Select the first frame to handle animated images properly 132 if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) ) 133 $this->image->setIteratorIndex(0); 134 93 135 $this->mime_type = $this->get_mime_type( $this->image->getImageFormat() ); 94 136 }
Note: See TracChangeset
for help on using the changeset viewer.