Thumbnail and exif fixes from DD32. see #7622
git-svn-id: https://develop.svn.wordpress.org/trunk@8879 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
61400609c9
commit
9e7d65df0d
@ -88,11 +88,13 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
||||
|
||||
$metadata = array();
|
||||
if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
|
||||
$imagesize = getimagesize( $file );
|
||||
$full_path_file = $file;
|
||||
$imagesize = getimagesize( $full_path_file );
|
||||
$metadata['width'] = $imagesize[0];
|
||||
$metadata['height'] = $imagesize[1];
|
||||
list($uwidth, $uheight) = wp_shrink_dimensions($metadata['width'], $metadata['height']);
|
||||
$metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
|
||||
|
||||
// Make the file path relative to the upload dir
|
||||
if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { // Get upload directory
|
||||
if ( 0 === strpos($file, $uploads['basedir']) ) {// Check that the upload base exists in the file path
|
||||
@ -107,13 +109,13 @@ function wp_generate_attachment_metadata( $attachment_id, $file ) {
|
||||
$sizes = apply_filters('intermediate_image_sizes', $sizes);
|
||||
|
||||
foreach ($sizes as $size) {
|
||||
$resized = image_make_intermediate_size( $file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") );
|
||||
$resized = image_make_intermediate_size( $full_path_file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") );
|
||||
if ( $resized )
|
||||
$metadata['sizes'][$size] = $resized;
|
||||
}
|
||||
|
||||
// fetch additional metadata from exif/iptc
|
||||
$image_meta = wp_read_image_metadata( $file );
|
||||
$image_meta = wp_read_image_metadata( $full_path_file );
|
||||
if ($image_meta)
|
||||
$metadata['image_meta'] = $image_meta;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user