diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php
index f1e72fe..894b5fd 100644
a
|
b
|
function wp_exif_date2ts($str) { |
251 | 251 | function wp_read_image_metadata( $file ) { |
252 | 252 | if ( ! file_exists( $file ) ) |
253 | 253 | return false; |
254 | | |
255 | 254 | list( , , $sourceImageType ) = getimagesize( $file ); |
256 | 255 | |
257 | 256 | // exif contains a bunch of data we'll probably never need formatted in ways |
… |
… |
function wp_read_image_metadata( $file ) { |
278 | 277 | |
279 | 278 | if ( ! empty( $info['APP13'] ) ) { |
280 | 279 | $iptc = iptcparse( $info['APP13'] ); |
281 | | |
282 | 280 | // headline, "A brief synopsis of the caption." |
283 | 281 | if ( ! empty( $iptc['2#105'][0] ) ) |
284 | 282 | $meta['title'] = trim( $iptc['2#105'][0] ); |
… |
… |
function wp_read_image_metadata( $file ) { |
288 | 286 | |
289 | 287 | if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption |
290 | 288 | $caption = trim( $iptc['2#120'][0] ); |
291 | | if ( empty( $meta['title'] ) ) { |
| 289 | if ( empty( $meta['title'] ) && strlen( $caption ) < 80 ) { |
292 | 290 | // Assume the title is stored in 2:120 if it's short. |
293 | | if ( strlen( $caption ) < 80 ) |
294 | | $meta['title'] = $caption; |
295 | | else |
296 | | $meta['caption'] = $caption; |
297 | | } elseif ( $caption != $meta['title'] ) { |
298 | | $meta['caption'] = $caption; |
| 291 | $meta['title'] = $caption; |
299 | 292 | } |
| 293 | $meta['caption'] = $caption; |
300 | 294 | } |
301 | 295 | |
302 | 296 | if ( ! empty( $iptc['2#110'][0] ) ) // credit |
… |
… |
function wp_read_image_metadata( $file ) { |
311 | 305 | $meta['copyright'] = trim( $iptc['2#116'][0] ); |
312 | 306 | } |
313 | 307 | } |
314 | | |
315 | 308 | /** |
316 | 309 | * Filter the image types to check for exif data. |
317 | 310 | * |
diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index e5ccf1e..a20edda 100644
a
|
b
|
function media_handle_upload($file_id, $post_id, $post_data = array(), $override |
264 | 264 | $file = $file['file']; |
265 | 265 | $title = $name; |
266 | 266 | $content = ''; |
| 267 | $excerpt = ''; |
267 | 268 | |
268 | 269 | if ( preg_match( '#^audio#', $type ) ) { |
269 | 270 | $meta = wp_read_audio_metadata( $file ); |
… |
… |
function media_handle_upload($file_id, $post_id, $post_data = array(), $override |
271 | 272 | if ( ! empty( $meta['title'] ) ) |
272 | 273 | $title = $meta['title']; |
273 | 274 | |
274 | | $content = ''; |
275 | | |
276 | 275 | if ( ! empty( $title ) ) { |
277 | 276 | |
278 | 277 | if ( ! empty( $meta['album'] ) && ! empty( $meta['artist'] ) ) { |
… |
… |
function media_handle_upload($file_id, $post_id, $post_data = array(), $override |
322 | 321 | if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) |
323 | 322 | $title = $image_meta['title']; |
324 | 323 | if ( trim( $image_meta['caption'] ) ) |
325 | | $content = $image_meta['caption']; |
| 324 | $excerpt = $image_meta['caption']; |
326 | 325 | } |
327 | 326 | |
328 | 327 | // Construct the attachment array |
… |
… |
function media_handle_upload($file_id, $post_id, $post_data = array(), $override |
332 | 331 | 'post_parent' => $post_id, |
333 | 332 | 'post_title' => $title, |
334 | 333 | 'post_content' => $content, |
| 334 | 'post_excerpt' => $excerpt, |
335 | 335 | ), $post_data ); |
336 | 336 | |
337 | 337 | // This should never be set as it would then overwrite an existing attachment. |