The MU forums have moved to WordPress.org

get-post-custom-values providing wrong image URL (4 posts)

  1. chinocharles
    Member
    Posted 5 years ago #

    I run dozens of blogs for a newspaper company and after finding out about WPMU I had to swap over. I'm extremely excited about it and am planning to use it for all of our blogs from here on out.

    I ran into one problem, however, when importing blogs that were running the Arthemia theme. The posts, comments and attachments all imported fine, but it seems that the following line is still calling to the old attachment path structure.

    <?php
    $values = get_post_custom_values("Image"); echo $values[0]; ?>

    Returns

    http://wpmu.oursite.com/theblog/wp-content/uploads/2008/09/theimage.jpg

    Is there any way to correct this without using mod_rewrite? The call to the thumbnail generator (timthumb.php) is fine, but the path to the images is still WP-style. What do I have to change to make it match the new WPMU structure?

    Also, the images in the posts themselves still refer to the old blog installs. It isn't the end of the world. I could leave the old folders there, but why would Wordpress populate the image folders in the blogs.dir folder if it wasn't going to use them in the posts? Is there some plugin or script that will correct this for all posts on a blog?

    Thanks!

  2. andrea_r
    Moderator
    Posted 5 years ago #

    It's the timthumb script. I've dealt with this specific theme even, many other have had the exact same issue with other themes using that script.

    quick fix: replace it with the get_the_image plguin instead.

  3. mattloak
    Member
    Posted 4 years ago #

    @andrea

    I have this same problem. I don't believe it is caused by the timtumb script. I had the get_the_image script too and it filled in the custom post value with the url to the first image so all of my posts have an custom post value that is wp-content/uploads/blah blah blah and now the new structure is /files/...

    Is there an easy way to fix this without doing a mod_rewrite or manually changing all those fields in the DB?

    I created a ..wp-content/blogs.dir/8/wp-content/uploads/... (8 is the blog id for the blog in question) directory and uploaded my old pictures into their respective folders so when the DB was looking for something in the "uploads" directory it would find it but for some reason it wouldn't work.

  4. sethmatics
    Member
    Posted 4 years ago #

    I recently dealt with this issue also. Although I'm using wordpress 3.0 also referred to as WPMU 3.0.

    For me the fix was changing the images links so they pulled the "ABSOLUTE" path, my my case the URL looked something like this

    <img src="http://samdemo.smwphosting.com/wp-content/themes/smshopper/timthumb.php?src=/public_html/wp-content/blogs.dir/7/files/Breeders-Select-Dog-Food.jpg&h=261&w=261&zc=1" style="width: 261px; height: 261px;">

    In my theme I had to place the "location" of my image into a custom field, I placed the absolute URL into this field of:
    /public_html/wp-content/blogs.dir/7/files/Breeders-Select-Dog-Food.jpg

    Temporary demo of this at:
    http://samdemo.smwphosting.com/

    If the demo stops working that means you can find the demo site at:
    http://samthedogtrainer.com

About this Topic

  • Started 5 years ago by chinocharles
  • Latest reply from sethmatics