WordPress.org

Support

Support » Plugins and Hacks » Manually uploading images, what am I missing?

Manually uploading images, what am I missing?

  • I’m writing a script that will aid me in updating WordPress images.

    Here is what I’m currently doing:

    #1 – Upload image to wp-content/uploads/year/month
    #2 – Create thumbnail (imagename.thumbnail.jpg|gif|png)
    #3 – Insert post into wp_posts with:
    post_type: attachment
    guid: http://wordpresssite.com/wp-content/uploads/year/month

    #4 – Insert row into wp_postmeta with:
    post_id: the current post id I’m messing with
    meta_key: _wp_attached_file
    meta_value: local path to file (/home/user/public_html/etc etc)

    Everything is fine, except when I go to the Uploads section of WordPress, only the image title shows, no actual image. However, if I click on it and the click “View”, it links me to the post which contains a link to the image which is valid.

    What am I missing here? I also tried adding the _wp_attachment_metadata to wp_postmeta as well, but that made no difference.

    Any help is -greatly- appreciated. Thanks!

  • The topic ‘Manually uploading images, what am I missing?’ is closed to new replies.