Support » Plugin: Smush Image Compression and Optimization » SmushIt overwrites image meta crop sizes as (string) instead of (int)

  • In the _wp_attachment_metadata column of wp_postmeta for an attachment, if you have SmushIt installed and activated, it will cast image height and width values from int to string.

    For example, before SmushIt:

    a:5:{s:5:"width";i:1500;s:6:"height";i:1024;s:4:"file";s:31:"2017/04/City-Space-Sidewalk.jpg";s:5:"sizes";a:5:{s:9:"thumbnail";a:4:{s:4:"file";s:31:"City-Space-Sidewalk-200x200.jpg";s:5:"width";i:200;s:6:"height";i:200;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:31:"City-Space-Sidewalk-400x273.jpg";s:5:"width";i:400;s:6:"height";i:273;s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:31:"City-Space-Sidewalk-768x524.jpg";s:5:"width";i:768;s:6:"height";i:524;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:32:"City-Space-Sidewalk-1000x683.jpg";s:5:"width";i:1000;s:6:"height";i:683;s:9:"mime-type";s:10:"image/jpeg";}s:6:"square";a:4:{s:4:"file";s:31:"City-Space-Sidewalk-600x600.jpg";s:5:"width";i:600;s:6:"height";i:600;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:12:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";s:8:"keywords";a:0:{}}}

    And the same photo uploaded to WordPress *after* SmushIt is installed and activated:

    a:5:{s:5:"width";s:4:"1500";s:6:"height";s:4:"1024";s:4:"file";s:31:"2017/04/City-Space-Sidewalk.jpg";s:5:"sizes";a:5:{s:9:"thumbnail";a:4:{s:4:"file";s:31:"City-Space-Sidewalk-200x200.jpg";s:5:"width";s:3:"200";s:6:"height";s:3:"200";s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:31:"City-Space-Sidewalk-400x273.jpg";s:5:"width";s:3:"400";s:6:"height";s:3:"273";s:9:"mime-type";s:10:"image/jpeg";}s:12:"medium_large";a:4:{s:4:"file";s:31:"City-Space-Sidewalk-768x524.jpg";s:5:"width";s:3:"768";s:6:"height";s:3:"524";s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:32:"City-Space-Sidewalk-1000x683.jpg";s:5:"width";s:4:"1000";s:6:"height";s:3:"683";s:9:"mime-type";s:10:"image/jpeg";}s:6:"square";a:4:{s:4:"file";s:31:"City-Space-Sidewalk-600x600.jpg";s:5:"width";s:3:"600";s:6:"height";s:3:"600";s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:11:{s:8:"aperture";s:1:"0";s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";s:1:"0";s:9:"copyright";s:0:"";s:12:"focal_length";s:1:"0";s:3:"iso";s:1:"0";s:13:"shutter_speed";s:1:"0";s:5:"title";s:0:"";s:11:"orientation";s:1:"0";}}

    In the above example, s:6:"height";i:683 is being converted to s:6:"height";s:3:"683"

    I would expect the serialized data to remain unchanged.

    • This topic was modified 2 years, 3 months ago by nootron.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Umesh Kumar

    (@umeshsingla)

    Hi @nootron,

    That’s a great catch, I’ll definitely look into it.

    Thanks for reporting the issue.

    Cheers, Umesh

    Plugin Author Umesh Kumar

    (@umeshsingla)

    Hi @nootron,

    I’ve gone through the issue, it happens only with Auto-smush, and that too because of the underlying procedure used by WordPress to send a http request.

    For now, if you really want the original image meta, you can probably switch to the old method of Auto-smush by adding define( 'WP_SMUSH_ASYNC', FALSE ) to your wp-config.php, or by turning off the Auto Smush feature and use Manual/Bulk Smush.

    Meanwhile, I’ll keep digging into it and see if I can find a workaround for this.

    Thanks, Umesh

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘SmushIt overwrites image meta crop sizes as (string) instead of (int)’ is closed to new replies.