From 355cf1770715ff532073d530b0925f230715d2ee Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 19 Jan 2007 00:19:03 +0000 Subject: [PATCH] Upload manager image viewer fixes from mdawaffe. fixes #3596 git-svn-id: https://develop.svn.wordpress.org/trunk@4767 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/upload-functions.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wp-admin/upload-functions.php b/wp-admin/upload-functions.php index 40bb97d76d..2ba76cdc0a 100644 --- a/wp-admin/upload-functions.php +++ b/wp-admin/upload-functions.php @@ -3,8 +3,17 @@ function wp_upload_display( $dims = false, $href = '' ) { global $post; $id = get_the_ID(); $attachment_data = wp_get_attachment_metadata( $id ); + $is_image = (int) wp_attachment_is_image(); + if ( !isset($attachment_data['width']) && $is_image ) { + if ( $image_data = getimagesize( get_attached_file( $id ) ) ) { + $attachment_data['width'] = $image_data[0]; + $attachment_data['height'] = $image_data[1]; + wp_update_attachment_metadata( $id, $attachment_data ); + } + } if ( isset($attachment_data['width']) ) list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128); + ob_start(); the_title(); $post_title = attribute_escape(ob_get_contents()); @@ -43,8 +52,9 @@ function wp_upload_display( $dims = false, $href = '' ) { $r .= "\t\t\t\t\n"; $r .= "\t\t\t\t\n"; } - $is_image = (int) wp_attachment_is_image(); + $r .= "\t\t\t\t\n"; + if ( isset($width) ) { $r .= "\t\t\t\t\n"; $r .= "\t\t\t\t\n";