1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MG 1.1 Import from Photopost - redirect embedded image URLs?

Discussion in 'Media Gallery Support' started by Sim, May 8, 2016.

  1. Sim

    Sim Well-Known Member

    I've just completed a migration from vB 3.8.x + Photopost to XF + XFMG and was wondering if there is an automated mechanism for redirecting embedded image URLs that were embedded from the gallery in forum posts on the old site.

    For example, we have plenty of posts that were imported where there was a photo uploaded to Photopost and then displayed in a forum post using bbcode, so you end up with code like this:

    Now of course, this URL is no longer valid after removing Photopost, so I'd like to put in some URL rewrites to redirect that to an actual valid XFMG URL.

    Is there something built in to XFMG which will do this automatically?

    If not, is the original file name indexed in the database anywhere so I can do a lookup and redirect to the new location?
  2. Sim

    Sim Well-Known Member

    I haven't tried it yet, but I'm thinking if I find the filename from the xf_attachment_data table, join it with the xf_attachment table on data_id to find the attachment_id, then join that with the xengallery_media table on attachment_id and specify the category_id from the URL in a where clause to validate ... that should give me what I need?
  3. Chris D

    Chris D XenForo Developer Staff Member

    There's nothing built in to achieve this.

    The common solution is to either leave the original files in place or use an add on which imports these as attachments.
  4. Sim

    Sim Well-Known Member

    Thanks Chris - I think I'm going to just sync the old gallery directory structure to a static S3 website and do a global find/replace on posts to swap to the new URL - will be easier than mucking around with database joins I think.
  5. Sim

    Sim Well-Known Member

    Actually, I didn't even bother with the search and replace - a couple of nginx rewrite rules and we're done.
    Chris D likes this.

Share This Page