Media: Move a variable definition outside of conditionals to ensure it's always available.
This fixes cases where the URL to a PDF preview may be incorrectly calculated when no thumbnails were generated for the PDF (and avoids a PHP Notice at the same time). Fixes #39250. Built from https://develop.svn.wordpress.org/trunk@39612 git-svn-id: http://core.svn.wordpress.org/trunk@39552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bc7a03a33b
commit
c92e916866
|
@ -3063,6 +3063,7 @@ function wp_prepare_attachment_for_js( $attachment ) {
|
||||||
list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
|
list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
|
||||||
|
|
||||||
$attachment_url = wp_get_attachment_url( $attachment->ID );
|
$attachment_url = wp_get_attachment_url( $attachment->ID );
|
||||||
|
$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
|
||||||
|
|
||||||
$response = array(
|
$response = array(
|
||||||
'id' => $attachment->ID,
|
'id' => $attachment->ID,
|
||||||
|
@ -3170,9 +3171,6 @@ function wp_prepare_attachment_for_js( $attachment ) {
|
||||||
'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape',
|
'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape',
|
||||||
);
|
);
|
||||||
} elseif ( isset( $meta['sizes'][ $size ] ) ) {
|
} elseif ( isset( $meta['sizes'][ $size ] ) ) {
|
||||||
if ( ! isset( $base_url ) )
|
|
||||||
$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
|
|
||||||
|
|
||||||
// Nothing from the filter, so consult image metadata if we have it.
|
// Nothing from the filter, so consult image metadata if we have it.
|
||||||
$size_meta = $meta['sizes'][ $size ];
|
$size_meta = $meta['sizes'][ $size ];
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-39603';
|
$wp_version = '4.8-alpha-39612';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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