Ticket #6142: remove-intermediate-images-r7201.patch
| File remove-intermediate-images-r7201.patch, 1.8 KB (added by , 18 years ago) |
|---|
-
wp-includes/post.php
2180 2180 } 2181 2181 } 2182 2182 2183 // remove intermediate images if there are any 2184 $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium')); 2185 foreach ( $sizes as $size ) { 2186 if ( $intermediate = image_get_intermediate_size($postid, $size) ) { 2187 $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); 2188 @ unlink($intermediate_file); 2189 } 2190 } 2191 2183 2192 $file = apply_filters('wp_delete_file', $file); 2184 2193 2185 2194 if ( ! empty($file) ) -
wp-includes/media.php
79 79 list( $width, $height ) = image_constrain_size_for_editor( $meta['width'], $meta['height'], $size ); 80 80 } 81 81 82 return array( $img_url, $width, $height ); 82 if ( $img_url) 83 return array( $img_url, $width, $height ); 84 return false; 83 85 84 86 } 85 87 … … 253 255 if ( empty($imagedata['sizes'][$size]) ) 254 256 return false; 255 257 256 return $imagedata['sizes'][$size]; 258 $data = $imagedata['sizes'][$size]; 259 // include the full filesystem path of the intermediate file 260 if ( empty($data['path']) && !empty($data['file']) ) { 261 $file_url = wp_get_attachment_url($post_id); 262 $data['path'] = path_join( dirname($imagedata['file']), $data['file'] ); 263 $data['url'] = path_join( dirname($file_url), $data['file'] ); 264 } 265 return $data; 257 266 } 258 267 259 268 // get an image to represent an attachment - a mime icon for files, thumbnail or intermediate size for images … … 290 299 return $html; 291 300 } 292 301 293 294 302 add_shortcode('gallery', 'gallery_shortcode'); 295 303 296 304 function gallery_shortcode($attr) {