mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 15:47:38 +02:00
Thumbnail and exif fixes from DD32. see #7622
git-svn-id: http://svn.automattic.com/wordpress/trunk@8879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8db1601dd7
commit
2c92ac6f0b
@ -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