Make WordPress Core

Opened 14 years ago

Closed 12 years ago

Last modified 12 years ago

#23706 closed defect (bug) (fixed)

Image metadata encoding problem

Reported by: pavelevap Owned by: SergeyBiryukov
Priority: normal Milestone: 4.0
Component: Media Version: 3.0
Severity: normal Keywords: has-patch needs-unit-tests 3.9-early commit
Cc: Focuses:

Description

I uploaded picture DSCF4480.jpg (attached for testing).

Metadata for title and caption should be the same: "Bystřice u Benešova". But after upload title is right, but caption is damaged:

'caption' => 'Bystøice u Benešova',
'title' => 'Bystřice u Benešova'

Using latest trunk.

Attachments (2)

DSCF4480.JPG​ (54.7 KB ) - added by pavelevap 14 years ago.
23706.patch​ (3.3 KB ) - added by SergeyBiryukov 14 years ago.

Download all attachments as: .zip

Change History (16)

@pavelevap
14 years ago

#1 @SergeyBiryukov
14 years ago

  • Component General → Media
  • Keywords has-patch needs-unit-tests added
  • Milestone Awaiting Review → 3.6
  • Version trunk → 3.0

Introduced in [13244].

iptcparse() returns the correct caption, but the result from exif_read_data() overwrites it:
​http://core.trac.wordpress.org/browser/tags/3.5.1/wp-admin/includes/image.php#L244

This is what we get from iptcparse():

Array
(
    [aperture] => 0
    [credit] => mirekk
    [camera] => 
    [caption] => Přístupový chodník k 1.koleji (budoucí směr Tábor)
    [created_timestamp] => 0
    [copyright] => http://www.4koridor.cz
    [focal_length] => 0
    [iso] => 0
    [shutter_speed] => 0
    [title] => Bystřice u Benešova
)

This what we get later after merging with exif_read_data():

Array
(
    [aperture] => 3.2
    [credit] => mirekk
    [camera] => FinePix S9600
    [caption] => Byst�ice u Bene�ova
    [created_timestamp] => 1348422433
    [copyright] => http://www.4koridor.cz
    [focal_length] => 6.2
    [iso] => 100
    [shutter_speed] => 0.00666666666667
    [title] => Bystřice u Benešova
)

According to ​this reply, the EXIF:ImageDescription tag does not officially support UTF-8.

I guess we should only fill in the missing data instead of stomping on existing values.

#2 @pavelevap
14 years ago

Thank you, Sergey!

I tested your patch and it works really well!

#3 @markjaquith
13 years ago

  • Keywords early added
  • Milestone 3.6 → Future Release

Punting this as we're focusing on 3.6 blockers now. Let's get this done early in 3.7.

#4 @pavelevap
13 years ago

Tested with latest 3.6, there were probably some changes.

Title is the same, but caption is in database without encoding problem now. I am not sure what was changed?

The only strange thing is that caption value is saved in metadata, but displayed as Desription field (in Media library) and Caption field is empty (post_excerpt value)?

#5 @SergeyBiryukov
13 years ago

  • Milestone Future Release → 3.7

#6 @nacin
13 years ago

  • Keywords commit added
  • Milestone 3.7 → 3.8

#7 @kraftbj
13 years ago

  • Cc bk@… added

#8 @nacin
13 years ago

  • Owner set to SergeyBiryukov
  • Status new → assigned

Sergey, if this is good to go, please commit.

#9 @SergeyBiryukov
13 years ago

  • Keywords 3.9-early added; early removed
  • Milestone 3.8 → Future Release

#10 @wonderboymusic
12 years ago

  • Resolution → fixed
  • Status assigned → closed

In 28367:

In wp_read_image_metadata(), the values from exif_read_data() should only override values from iptcparse() that are empty.

Props SergeyBiryukov.
Fixes #23706.

#11 @wonderboymusic
12 years ago

  • Milestone Future Release → 4.0

#12 follow-up: @pavelevap
12 years ago

  • Resolution fixed
  • Status closed → reopened

Please see my older comment: https://core.trac.wordpress.org/ticket/23706#comment:4

The only strange thing is that caption value is saved in metadata, but displayed as Desription field (in Media library) and Caption field is empty (post_excerpt value)?

And another note. We are saving these really long values into database (you can test attached image)? Is it really needed?

aperture = 3.20000000000000017763568394002504646778106689453125

shutter_speed = 0.0066666666666667

#13 in reply to: ↑ 12 @helen
12 years ago

  • Resolution → fixed
  • Status reopened → closed

Replying to pavelevap:

The only strange thing is that caption value is saved in metadata, but displayed as Desription field (in Media library) and Caption field is empty (post_excerpt value)?

#22768

And another note. We are saving these really long values into database (you can test attached image)? Is it really needed?

Why not keep data that's there? Also, that doesn't seem like a part of this ticket.

#14 @pavelevap
12 years ago

Sorry, I did not notice related ticket.

Should I create another ticket for strange values? I am not sure if it is worth it, but numbers are really long, not sure if really used for something with that presision...

Note: See TracTickets for help on using tickets.