WordPress.org

Support

Support » Plugins and Hacks » Detecting wrong image size

Detecting wrong image size

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jason

    @verysimple

    Imsanity uses the wordpress meta-data which is found in the the “posts” table – you’ll find a row in there for each image upload with a type of “attachment”. it has a meta data field where WordPress stores all of the various sizes (original, thum, medium, large). Imsanity uses this WordPress metadata – it doesn’t look at the file itself.

    So, it could be that WordPress is reading the EXIF data (or read the data at one point) and stored the dimensions, which are now out of date.

    Imsanity does update the WordPress metadata after it resizes the image (at least it is supposed to)

    Plugin Author Jason

    @verysimple

    Here is the query you can run to see the metadata for your files:

    select
    wp_posts.ID as ID,
    wp_posts.guid as guid,
    wp_postmeta.meta_value as file_meta
    from wp_posts
    inner join wp_postmeta on wp_posts.ID = wp_postmeta.post_id and wp_postmeta.meta_key = '_wp_attachment_metadata'
    where wp_posts.post_type = 'attachment'
    and wp_posts.post_mime_type like 'image%'
    and wp_posts.post_mime_type != 'image/bmp'

    Thanks for that. Here is the file_meta for that image:

    a:6:{s:5:"width";i:2000;s:6:"height";i:1333;s:14:"hwstring_small";s:23:"height='85' width='128'";s:4:"file";s:28:"2012/12/kitchen-IMG_5804.jpg";s:5:"sizes";a:4:{s:9:"thumbnail";a:3:{s:4:"file";s:28:"kitchen-IMG_5804-150x100.jpg";s:5:"width";s:3:"150";s:6:"height";s:3:"100";}s:6:"medium";a:3:{s:4:"file";s:28:"kitchen-IMG_5804-600x400.jpg";s:5:"width";s:3:"600";s:6:"height";s:3:"400";}s:5:"large";a:3:{s:4:"file";s:30:"kitchen-IMG_5804-2000x1333.jpg";s:5:"width";s:4:"2000";s:6:"height";s:4:"1333";}s:20:"repository_logo_size";a:3:{s:4:"file";s:28:"kitchen-IMG_5804-285x115.jpg";s:5:"width";s:3:"285";s:6:"height";s:3:"115";}}s:10:"image_meta";a:10:{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:"";}}

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Detecting wrong image size’ is closed to new replies.