mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-01 21:21:24 +01:00
Media: Bring consistency to getimagesize()
error suppression.
Props chasewg, joemcgill, jeremyfelt. Fixes #42480. Built from https://develop.svn.wordpress.org/trunk@42449 git-svn-id: http://core.svn.wordpress.org/trunk@42279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9cb44f5f2f
commit
35653f0432
@ -357,7 +357,7 @@ function wp_read_image_metadata( $file ) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
list( , , $sourceImageType ) = getimagesize( $file );
|
list( , , $sourceImageType ) = @getimagesize( $file );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EXIF contains a bunch of data we'll probably never need formatted in ways
|
* EXIF contains a bunch of data we'll probably never need formatted in ways
|
||||||
@ -386,10 +386,10 @@ function wp_read_image_metadata( $file ) {
|
|||||||
* as caption, description etc.
|
* as caption, description etc.
|
||||||
*/
|
*/
|
||||||
if ( is_callable( 'iptcparse' ) ) {
|
if ( is_callable( 'iptcparse' ) ) {
|
||||||
getimagesize( $file, $info );
|
@getimagesize( $file, $info );
|
||||||
|
|
||||||
if ( ! empty( $info['APP13'] ) ) {
|
if ( ! empty( $info['APP13'] ) ) {
|
||||||
$iptc = iptcparse( $info['APP13'] );
|
$iptc = @iptcparse( $info['APP13'] );
|
||||||
|
|
||||||
// Headline, "A brief synopsis of the caption."
|
// Headline, "A brief synopsis of the caption."
|
||||||
if ( ! empty( $iptc['2#105'][0] ) ) {
|
if ( ! empty( $iptc['2#105'][0] ) ) {
|
||||||
|
@ -369,7 +369,7 @@ function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use image exif/iptc data for title and caption defaults if possible.
|
// Use image exif/iptc data for title and caption defaults if possible.
|
||||||
} elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = @wp_read_image_metadata( $file ) ) {
|
} elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = wp_read_image_metadata( $file ) ) {
|
||||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||||
$title = $image_meta['title'];
|
$title = $image_meta['title'];
|
||||||
}
|
}
|
||||||
@ -437,7 +437,7 @@ function media_handle_sideload( $file_array, $post_id, $desc = null, $post_data
|
|||||||
$content = '';
|
$content = '';
|
||||||
|
|
||||||
// Use image exif/iptc data for title and caption defaults if possible.
|
// Use image exif/iptc data for title and caption defaults if possible.
|
||||||
if ( $image_meta = @wp_read_image_metadata( $file ) ) {
|
if ( $image_meta = wp_read_image_metadata( $file ) ) {
|
||||||
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||||
$title = $image_meta['title'];
|
$title = $image_meta['title'];
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||||||
$file = $file['file'];
|
$file = $file['file'];
|
||||||
|
|
||||||
// use image exif/iptc data for title and caption defaults if possible
|
// use image exif/iptc data for title and caption defaults if possible
|
||||||
$image_meta = @wp_read_image_metadata( $file );
|
$image_meta = wp_read_image_metadata( $file );
|
||||||
|
|
||||||
if ( ! empty( $image_meta ) ) {
|
if ( ! empty( $image_meta ) ) {
|
||||||
if ( empty( $request['title'] ) && trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
if ( empty( $request['title'] ) && trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-42447';
|
$wp_version = '5.0-alpha-42449';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user