[wp-trac] [WordPress Trac] #35480: Some notice and warning in wp_calculate_image_srcset() function media.php

WordPress Trac noreply at wordpress.org
Mon Jan 18 15:36:00 UTC 2016


#35480: Some notice and warning in wp_calculate_image_srcset() function media.php
----------------------------------------+------------------------
 Reporter:  overclokk                   |       Owner:  joemcgill
     Type:  defect (bug)                |      Status:  accepted
 Priority:  normal                      |   Milestone:  4.5
Component:  Media                       |     Version:  4.4.1
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:  template
----------------------------------------+------------------------

Comment (by ocean90):

 I've noticed a similar warning at
 https://make.wordpress.org/flow/2014/05/12/visual-record-front-page-to-
 new-post-on-an-ipad-air/img_0806/ where for some reasons the meta data is
 corrupted.

 `Warning: strpos(): Empty needle in wp-includes/media.php on line 1099`


 {{{
 // var_dump( $image_meta );
 array (size=5)
   'width' => int 2048
   'height' => int 1536
   'file' => string '/' (length=1) // Oops?!
   'sizes' =>
     array (size=3)
       'thumbnail' =>
         array (size=4)
           'file' => string 'IMG_0806-150x150.png' (length=20)
           'width' => int 150
           'height' => int 150
           'mime-type' => string 'image/png' (length=9)
       'medium' =>
         array (size=4)
           'file' => string 'IMG_0806-300x225.png' (length=20)
           'width' => int 300
           'height' => int 225
           'mime-type' => string 'image/png' (length=9)
       'large' =>
         array (size=4)
           'file' => string 'IMG_0806-1024x768.png' (length=21)
           'width' => int 1024
           'height' => int 768
           'mime-type' => string 'image/png' (length=9)
   'image_meta' =>
     array (size=10)
       'aperture' => int 0
       'credit' => string '' (length=0)
       'camera' => string '' (length=0)
       'caption' => string '' (length=0)
       'created_timestamp' => int 0
       'copyright' => string '' (length=0)
       'focal_length' => int 0
       'iso' => int 0
       'shutter_speed' => int 0
       'title' => string '' (length=0)
 }}}


 {{{
 // var_dump( $image_sizes );
 array (size=4)
   'thumbnail' =>
     array (size=4)
       'file' => string 'IMG_0806-150x150.png' (length=20)
       'width' => int 150
       'height' => int 150
       'mime-type' => string 'image/png' (length=9)
   'medium' =>
     array (size=4)
       'file' => string 'IMG_0806-300x225.png' (length=20)
       'width' => int 300
       'height' => int 225
       'mime-type' => string 'image/png' (length=9)
   'large' =>
     array (size=4)
       'file' => string 'IMG_0806-1024x768.png' (length=21)
       'width' => int 1024
       'height' => int 768
       'mime-type' => string 'image/png' (length=9)
   'full' =>
     array (size=3)
       'width' => int 2048
       'height' => int 1536
       'file' => string '' (length=0)
 }}}

 I'm not sure if `wp_calculate_image_srcset()` needs to handle this case
 though.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35480#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list