[wp-trac] [WordPress Trac] #58240: wp_read_image_metadata() doesn't handle Exif array values

WordPress Trac noreply at wordpress.org
Wed May 3 06:02:01 UTC 2023


#58240: wp_read_image_metadata() doesn't handle Exif array values
--------------------------+-----------------------------
 Reporter:  dd32          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 Some images appear to have multiple values for some headers, which causes
 `wp_read_image_metadata()` to return `'Array'` for some fields.

 A real-life example are these images:
  - https://wordpress.org/photos/photo/3056444e62/
  - https://wordpress.org/photos/photo/7716444e53/
  - https://wordpress.org/photos/photo/5376444e57/

 Looking at the return value from `exif_read_data()` for one of these,
 you'll see arrays below. However `wp_read_image_metadata()` includes lines
 like `(string) $exif['FocalLength'];`. It looks like `iPhone 13 mini`
 might be common between the above examples
 {{{
 [...]
   'SectionsFound' =>
   string(19) "ANY_TAG, IFD0, EXIF"
   'COMPUTED' =>
   array(6) {
 [...]
     'ApertureFNumber' =>
     string(5) "f/1.6"
   }
 [...]
   'Make' =>
   string(5) "Apple"
   'Model' =>
   string(48) "iPhone 13 mini back dual wide camera 5.1mm f/1.6"
   'Exif_IFD_Pointer' =>
   int(106)
   'ApertureValue' =>
   array(2) {
     [0] =>
     string(9) "1356/1000"
     [1] =>
     string(9) "8803/1000"
   }
 [...]
   'FocalLength' =>
   array(2) {
     [0] =>
     string(9) "5100/1000"
     [1] =>
     string(10) "10884/1000"
   }
   'ShutterSpeedValue' =>
   array(2) {
     [0] =>
     string(10) "10884/1000"
     [1] =>
     string(19) "1124129791/84149760"
   }
 }}}

 As a result on the above Photo pages you'll see something like this:
 {{{
 Focal Length: Arraymm
 Shutter Speed: 1/0
 }}}

 This could be related to the image processing application being used, or
 the sections found in the image. I'd be tempted to just select the first
 array key in those cases.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58240>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list