Changeset 48798 for trunk/src/wp-admin/includes/image-edit.php
- Timestamp:
- 08/16/2020 01:31:57 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/image-edit.php
r48375 r48798 292 292 * @deprecated 3.5.0 Use {@see 'image_editor_save_pre'} instead. 293 293 * 294 * @param resource $image Image resource to be streamed.295 * @param int $attachment_id The attachment post ID.294 * @param resource|GdImage $image Image resource to be streamed. 295 * @param int $attachment_id The attachment post ID. 296 296 */ 297 297 $image = apply_filters_deprecated( 'image_save_pre', array( $image, $attachment_id ), '3.5.0', 'image_editor_save_pre' ); … … 421 421 * 422 422 * @ignore 423 * @param resource $img Image resource.424 * @param float|int $angle Image rotation angle, in degrees.425 * @return resource| false GD image resource, false otherwise.423 * @param resource|GdImage $img Image resource. 424 * @param float|int $angle Image rotation angle, in degrees. 425 * @return resource|GdImage|false GD image resource or GdImage instance, false otherwise. 426 426 */ 427 427 function _rotate_image_resource( $img, $angle ) { 428 428 _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::rotate()' ); 429 429 430 if ( function_exists( 'imagerotate' ) ) { 430 431 $rotated = imagerotate( $img, $angle, 0 ); 431 if ( is_resource( $rotated ) ) { 432 433 if ( is_gd_image( $rotated ) ) { 432 434 imagedestroy( $img ); 433 435 $img = $rotated; 434 436 } 435 437 } 438 436 439 return $img; 437 440 } … … 445 448 * 446 449 * @ignore 447 * @param resource $img Image resource.448 * @param bool $horz Whether to flip horizontally.449 * @param bool $vert Whether to flip vertically.450 * @return resource (maybe) flipped image resource.450 * @param resource|GdImage $img Image resource or GdImage instance. 451 * @param bool $horz Whether to flip horizontally. 452 * @param bool $vert Whether to flip vertically. 453 * @return resource|GdImage (maybe) flipped image resource or GdImage instance. 451 454 */ 452 455 function _flip_image_resource( $img, $horz, $vert ) { 453 456 _deprecated_function( __FUNCTION__, '3.5.0', 'WP_Image_Editor::flip()' ); 457 454 458 $w = imagesx( $img ); 455 459 $h = imagesy( $img ); 456 460 $dst = wp_imagecreatetruecolor( $w, $h ); 457 if ( is_resource( $dst ) ) { 461 462 if ( is_gd_image( $dst ) ) { 458 463 $sx = $vert ? ( $w - 1 ) : 0; 459 464 $sy = $horz ? ( $h - 1 ) : 0; … … 466 471 } 467 472 } 473 468 474 return $img; 469 475 } … … 475 481 * 476 482 * @ignore 477 * @param resource $img Image resource.478 * @param float $x Source point x-coordinate.479 * @param float $y Source point y-coordinate.480 * @param float $w Source width.481 * @param float $h Source height.482 * @return resource (maybe) cropped image resource.483 * @param resource|GdImage $img Image resource or GdImage instance. 484 * @param float $x Source point x-coordinate. 485 * @param float $y Source point y-coordinate. 486 * @param float $w Source width. 487 * @param float $h Source height. 488 * @return resource|GdImage (maybe) cropped image resource or GdImage instance. 483 489 */ 484 490 function _crop_image_resource( $img, $x, $y, $w, $h ) { 485 491 $dst = wp_imagecreatetruecolor( $w, $h ); 486 if ( is_resource( $dst ) ) { 492 493 if ( is_gd_image( $dst ) ) { 487 494 if ( imagecopy( $dst, $img, 0, 0, $x, $y, $w, $h ) ) { 488 495 imagedestroy( $img ); … … 490 497 } 491 498 } 499 492 500 return $img; 493 501 } … … 503 511 */ 504 512 function image_edit_apply_changes( $image, $changes ) { 505 if ( is_ resource( $image ) ) {513 if ( is_gd_image( $image ) ) { 506 514 /* translators: 1: $image, 2: WP_Image_Editor */ 507 515 _deprecated_argument( __FUNCTION__, '3.5.0', sprintf( __( '%1$s needs to be a %2$s object.' ), '$image', 'WP_Image_Editor' ) ); … … 567 575 */ 568 576 $image = apply_filters( 'wp_image_editor_before_change', $image, $changes ); 569 } elseif ( is_ resource( $image ) ) {577 } elseif ( is_gd_image( $image ) ) { 570 578 571 579 /** … … 575 583 * @deprecated 3.5.0 Use {@see 'wp_image_editor_before_change'} instead. 576 584 * 577 * @param resource $image GD image resource.578 * @param array $changes Array of change operations.585 * @param resource|GdImage $image GD image resource or GdImage instance. 586 * @param array $changes Array of change operations. 579 587 */ 580 588 $image = apply_filters_deprecated( 'image_edit_before_change', array( $image, $changes ), '3.5.0', 'wp_image_editor_before_change' );
Note: See TracChangeset
for help on using the changeset viewer.