Changeset 22817 for trunk/wp-includes/class-wp-image-editor-gd.php
- Timestamp:
- 11/22/2012 09:52:16 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class-wp-image-editor-gd.php
r22619 r22817 16 16 */ 17 17 class WP_Image_Editor_GD extends WP_Image_Editor { 18 18 19 protected $image = false; // GD Resource 19 20 … … 33 34 * @return boolean 34 35 */ 35 public static function test( $args = null) {36 public static function test( $args = array() ) { 36 37 if ( ! extension_loaded('gd') || ! function_exists('gd_info') ) 37 38 return false; … … 41 42 42 43 /** 44 * Checks to see if editor supports the mime-type specified. 45 * 46 * @since 3.5.0 47 * @access public 48 * 49 * @param string $mime_type 50 * @return boolean 51 */ 52 public static function supports_mime_type( $mime_type ) { 53 $image_types = imagetypes(); 54 switch( $mime_type ) { 55 case 'image/jpeg': 56 return ($image_types & IMG_JPG) != 0; 57 case 'image/png': 58 return ($image_types & IMG_PNG) != 0; 59 case 'image/gif': 60 return ($image_types & IMG_GIF) != 0; 61 } 62 63 return false; 64 } 65 66 /** 43 67 * Loads image from $this->file into new GD Resource. 44 68 * … … 48 72 * @return boolean|\WP_Error 49 73 */ 50 p rotectedfunction load() {74 public function load() { 51 75 if ( $this->image ) 52 76 return true; … … 89 113 90 114 return parent::update_size( $width, $height ); 91 }92 93 /**94 * Checks to see if editor supports the mime-type specified.95 *96 * @since 3.5.097 * @access public98 *99 * @param string $mime_type100 * @return boolean101 */102 public static function supports_mime_type( $mime_type ) {103 $allowed_mime_types = array( 'image/gif', 'image/png', 'image/jpeg' );104 105 return in_array( $mime_type, $allowed_mime_types );106 115 } 107 116 … … 262 271 * @access public 263 272 * 264 * @param boolean $horz Horizon al Flip273 * @param boolean $horz Horizontal Flip 265 274 * @param boolean $vert Vertical Flip 266 275 * @returns boolean|WP_Error
Note: See TracChangeset
for help on using the changeset viewer.