47 | | if ( 0 == $src_x && 0 == $src_y && $src_w == $dst_w && $src_h == $dst_h ) |
48 | | return ( is_numeric( $src ) ) ? get_attached_file( $src ) : $src; |
| 47 | if ( 0 == $src_x && 0 == $src_y && $src_w == $dst_w && $src_h == $dst_h ) { |
| 48 | // No cropping, just copy the file |
| 49 | if ( is_numeric( $src ) ) { |
| 50 | $src_file = get_attached_file( $src ); |
| 51 | if ( ! file_exists( $src_file ) ) |
| 52 | $src_file = _load_image_file( $src ); |
| 53 | } else { |
| 54 | $src_file = $src; |
| 55 | } |
367 | | function load_image_to_edit($post_id, $mime_type, $size = 'full') { |
| 381 | /** |
| 382 | * Attempt to load an attachment from URL (for replication plugins). |
| 383 | * |
| 384 | * @since 3.4.0 |
| 385 | * @access private |
| 386 | * |
| 387 | * @param string $post_id Attachment post ID. |
| 388 | * @param string $size Optional. Image size, defaults to 'full'. |
| 389 | * @return string|false Local file path on success, false on failure. |
| 390 | */ |
| 391 | function _load_image_file( $post_id, $size = 'full' ) { |
| 407 | /** |
| 408 | * Load an image resource for editing. |
| 409 | * |
| 410 | * @since 2.9.0 |
| 411 | * |
| 412 | * @param string $post_id Attachment post ID. |
| 413 | * @param string $mime_type Image mime type. |
| 414 | * @param string $size Optional. Image size, defaults to 'full'. |
| 415 | * @return resource|false The resulting image resource on success, false on failure. |
| 416 | */ |
| 417 | function load_image_to_edit( $post_id, $mime_type, $size = 'full' ) { |
| 418 | $filepath = _load_image_file( $post_id, $size ); |
| 419 | if ( empty( $filepath ) ) |
| 420 | return false; |
| 421 | |