Manually uploading images, what am I missing? (1 post)

  1. aluminumpork
    Posted 9 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic