|
@@ 50-55 (lines=6) @@
|
| 47 |
|
$_image_url = set_url_scheme( $image_url ); |
| 48 |
|
if ( wp_startswith( $_image_url, $content_url ) ) { |
| 49 |
|
$_image_path = str_replace( $content_url, ABSPATH . 'wp-content', $_image_url ); |
| 50 |
|
if ( file_exists( $_image_path ) ) { |
| 51 |
|
list( $ext, $type ) = wp_check_filetype( $_image_path ); |
| 52 |
|
if ( wp_startswith( $type, 'image/' ) ) { |
| 53 |
|
$data = file_get_contents( $_image_path ); |
| 54 |
|
} |
| 55 |
|
} |
| 56 |
|
} |
| 57 |
|
|
| 58 |
|
if ( empty( $data ) ) { |
|
@@ 68-73 (lines=6) @@
|
| 65 |
|
} |
| 66 |
|
|
| 67 |
|
// If it's a local path in our WordPress install (no snooping around the filesystem): |
| 68 |
|
if ( file_exists( $image_url ) ) { |
| 69 |
|
list( $ext, $type ) = wp_check_filetype( $image_url ); |
| 70 |
|
if ( wp_startswith( $type, 'image/' ) ) { |
| 71 |
|
$data = file_get_contents( $image_url ); |
| 72 |
|
} |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
// Now turn it into an image and return it. |
| 76 |
|
return imagecreatefromstring( $data ); |