Invalid link in wp_postmeta / Image file deleted
-
My WordPress installation has the following media settings for icon sizes:
- 200 x 200
- 350 x 300
- 1024 x 768
Now I upload the file, which Imsanity is not active on my WordPress installation. The following files are created in my
Uploads
directory:../wp-content/uploads/2013/12/MK227105-1024x450.jpg ../wp-content/uploads/2013/12/MK227105-1024x682.jpg ../wp-content/uploads/2013/12/MK227105-1140x450.jpg ../wp-content/uploads/2013/12/MK227105-200x133.jpg ../wp-content/uploads/2013/12/MK227105-300x199.jpg ../wp-content/uploads/2013/12/MK227105-350x233.jpg ../wp-content/uploads/2013/12/MK227105-390x261.jpg ../wp-content/uploads/2013/12/MK227105-690x462.jpg ../wp-content/uploads/2013/12/MK227105.jpg
(Why I have some darn many versions of the image is a good question, but outside of this issue…)
Table
wp_postmeta
has got the following entry:a:5:{s:5:"width";i:1600;s:6:"height";i:1067;s:4:"file";s:20:"2013/12/MK227105.jpg";s:5:"sizes";a:6:{s:9:"thumbnail";a:4:{s:4:"file";s:20:"MK227105-200x133.jpg";s:5:"width";i:200;s:6:"height";i:133;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:20:"MK227105-350x233.jpg";s:5:"width";i:350;s:6:"height";i:233;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:21:"MK227105-1024x682.jpg";s:5:"width";i:1024;s:6:"height";i:682;s:9:"mime-type";s:10:"image/jpeg";}s:6:"slider";a:4:{s:4:"file";s:21:"MK227105-1140x450.jpg";s:5:"width";i:1140;s:6:"height";i:450;s:9:"mime-type";s:10:"image/jpeg";}s:8:"featured";a:4:{s:4:"file";s:20:"MK227105-690x462.jpg";s:5:"width";i:690;s:6:"height";i:462;s:9:"mime-type";s:10:"image/jpeg";}s:14:"small-featured";a:4:{s:4:"file";s:20:"MK227105-390x261.jpg";s:5:"width";i:390;s:6:"height";i:261;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:10:{s:8:"aperture";d:5.5999999999999996;s:6:"credit";s:0:"";s:6:"camera";s:22:"Canon EOS-1D Mark II N";s:7:"caption";s:0:"";s:17:"created_timestamp";i:1342371972;s:9:"copyright";s:0:"";s:12:"focal_length";s:3:"240";s:3:"iso";s:4:"1250";s:13:"shutter_speed";s:8:"0.000625";s:5:"title";s:0:"";}}
After this, I set up Imsanity and give it maximum dimensions of 1024 x 768, which happens to be the same size as the Large image size is (under Settings > Media). After running Imsanity, what happens is the following:
MK227105.jpg
is scaled down to proper dimensions. Nice!- MK227105-1024×682.jpg is deleted from the Uploads directory!
I am not sure if the deletion of the Large file is a feature – I guess it is not needed anymore, since the Large image version now has the same dimensions as the full-size image.
However, problems occur (e.g. with plugins such as Prettygallery) when this function is called:
wp_get_attachment_image_src(179,'large',false)
(179 being the post id of this image). The function returns:Array ( [0] => https://kuonot.fi/wp-content/uploads/2013/12/MK227105-1024x682.jpg [1] => 690 [2] => 459 [3] => 1 )
… which is an reference to a deleted image file.
A new query to
wp_postmeta
shows the root of the issue:a:5:{s:5:"width";i:1024;s:6:"height";i:682;s:4:"file";s:20:"2013/12/MK227105.jpg";s:5:"sizes";a:6:{s:9:"thumbnail";a:4:{s:4:"file";s:20:"MK227105-200x133.jpg";s:5:"width";i:200;s:6:"height";i:133;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:20:"MK227105-350x233.jpg";s:5:"width";i:350;s:6:"height";i:233;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:21:"MK227105-1024x682.jpg";s:5:"width";i:1024;s:6:"height";i:682;s:9:"mime-type";s:10:"image/jpeg";}s:6:"slider";a:4:{s:4:"file";s:21:"MK227105-1140x450.jpg";s:5:"width";i:1140;s:6:"height";i:450;s:9:"mime-type";s:10:"image/jpeg";}s:8:"featured";a:4:{s:4:"file";s:20:"MK227105-690x462.jpg";s:5:"width";i:690;s:6:"height";i:462;s:9:"mime-type";s:10:"image/jpeg";}s:14:"small-featured";a:4:{s:4:"file";s:20:"MK227105-390x261.jpg";s:5:"width";i:390;s:6:"height";i:261;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:10:{s:8:"aperture";d:5.5999999999999996;s:6:"credit";s:0:"";s:6:"camera";s:22:"Canon EOS-1D Mark II N";s:7:"caption";s:0:"";s:17:"created_timestamp";i:1342371972;s:9:"copyright";s:0:"";s:12:"focal_length";s:3:"240";s:3:"iso";s:4:"1250";s:13:"shutter_speed";s:8:"0.000625";s:5:"title";s:0:"";}}
(The Large image version still refers to
MK227105-1024x682.jpg
, which is the file deleted by Imsanity.)Maybe you are not updating
wp_postmeta
table properly?I am using Imsanity version 2.2.4.
- The topic ‘Invalid link in wp_postmeta / Image file deleted’ is closed to new replies.