Media: Add link to the original image in the image properties if it was scaled or rotated after uploading.

Fixes #49290.
Built from https://develop.svn.wordpress.org/trunk@47202


git-svn-id: http://core.svn.wordpress.org/trunk@47002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2020-02-07 05:13:05 +00:00
parent d1b39f784c
commit aea25de893
4 changed files with 27 additions and 1 deletions

View File

@ -3391,6 +3391,17 @@ function attachment_submitbox_metadata() {
</div>
<?php
}
if ( ! empty( $meta['original_image'] ) ) {
?>
<div class="misc-pub-section misc-pub-original-image">
<?php _e( 'Original image:' ); ?>
<a href="<?php echo esc_url( wp_get_original_image_url( $attachment_id ) ); ?>">
<?php echo esc_html( wp_basename( wp_get_original_image_path( $attachment_id ) ) ); ?>
</a>
</div>
<?php
}
}
/**

View File

@ -425,6 +425,11 @@ function wp_print_media_templates() {
?>
</div>
<# } #>
<# if ( data.originalImageURL && data.originalImageName ) { #>
<?php _e( 'Original image:' ); ?>
<a href="{{ data.originalImageURL }}">{{data.originalImageName}}</a>
<# } #>
<# } #>
<# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
@ -616,6 +621,11 @@ function wp_print_media_templates() {
</div>
<# } #>
<# if ( data.originalImageURL && data.originalImageName ) { #>
<?php _e( 'Original image:' ); ?>
<a href="{{ data.originalImageURL }}">{{data.originalImageName}}</a>
<# } #>
<# if ( data.can.save && data.sizes ) { #>
<a class="edit-attachment" href="{{ data.editLink }}&amp;image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a>
<# } #>

View File

@ -3560,6 +3560,11 @@ function wp_prepare_attachment_for_js( $attachment ) {
}
if ( 'image' === $type ) {
if ( ! empty( $meta['original_image'] ) ) {
$response['originalImageURL'] = wp_get_original_image_url( $attachment->ID );
$response['originalImageName'] = wp_basename( wp_get_original_image_path( $attachment->ID ) );
}
$sizes['full'] = array( 'url' => $attachment_url );
if ( isset( $meta['height'], $meta['width'] ) ) {

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47201';
$wp_version = '5.4-alpha-47202';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.