The MU forums have moved to WordPress.org

Media library empty after upgrade to WPMU (6 posts)

  1. omadawn
    Member
    Posted 15 years ago #

    We just upgraded from wordpress to wordpressMU. WPMU seems to be using wp-content/blogs.dir/ for the media library. The old wordpress used wp-content/uploads for the media library. It doesn't look like I can just copy the images over. How do I get access to them or migrate them to the new system?

  2. Ovidiu
    Member
    Posted 15 years ago #

    you don't upgrade from wordpress to wpmu.
    you might import your wordpress into a wpmu installation.
    That said, you have to wait for the experts to give you more detailed help :-(

  3. andrea_r
    Moderator
    Posted 15 years ago #

    You're kind stuck.

    On the new system, put them in the same area as they were on the *old* system. That way legacy links in posts will show images.

    If you look under /blogs.dir/, there will be a folder created for each blog by ID and then under *that* will be a similar structure. Upload a test image first to help create needed folders.

    you can then copy over another copy of the folder (or make symlinks) under that if you need access to previous photos before the switch (which may or may not show up. Hrm. Can't remember.)

  4. Ovidiu
    Member
    Posted 15 years ago #

  5. omadawn
    Member
    Posted 15 years ago #

    Andrea_r: I moved all the images to blogs.dir/1/files directory and that causes them to be in the media library and makes the URL paths work the same as on the previous non mu version.

    However none of the images that now show up have thumbnails making them completely useless from the 'media library' standpoint. My organization uses the library just the way it sounds, they upload tons of images of various things and then when a blog author needs something like, a dollar sign or a picture of a house or something they can look through it and find something they need.

    Ovidiu: your link looks fantastic. I am reading it right now. that just might save my hide, we have thousands of images in our media library right now and uploadint them all one at a time isn't an option.

    Thank you both for the very helpful input.

  6. rekall
    Member
    Posted 14 years ago #

    if you use the wordpress export (to WXR format .xml) on your former blog and the wordpress import tool on your new instance, DO select the checkbox to get images/media from the source server. in MOST cases, the images Will get copied to their new home in /blogs.dir/[site.id]/ etc.

    however depending on how your former install was configured, the imported posts will still hold references to the old image locations. so here's what you do...

    figure out what your blog_id and path is...
    you can do this either by:

    SELECT blog_id, domain, path FROM wp_blogs

    -or-

    in wpmu's wp-admin, click Site Admin, Blogs
    and in that list you'll see ID next to each of your blogs.

    get into mysql on the commandline or in phpmyadmin
    and issue these queries, one at a time:

    UPDATE wp_#ID#_posts SET post_content = REPLACE(post_content,'"http://#DOMAIN#/wp-content/uploads/','"/wp-content/uploads/');

    UPDATE wp_#ID#_posts SET post_content = REPLACE(post_content,'"/wp-content/uploads//','"/wp-content/uploads/');

    UPDATE wp_#ID#_posts SET post_content = REPLACE(post_content,'"/wp-content/uploads/','"#PATH#files/');

    in each of these it's single-quote then double-quote prefixing each file path -- we do this so we don't end up modifying any image href's your blog may have made to OTHER wordpress sites other than your own.

    #ID# is your blog's id
    #DOMAIN# is your blog's FORMER domain name (not the new one)
    #PATH# is your blog's path, if you're using subdirectories, otherwise blank. (note that in the query above it should look like '"/PATH/files/')

    and that should resolve Most of your posts' image references.

    the middle query modifies any image references that looked like /wp-content/uploads//2009/10/09/... so they have just a single /.
    might as well clean things up while we're at it!

About this Topic