• 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?

Sim

Well-known member
#1
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:

Code:
[img]http://www.example.com/forums/gallery/data/506/my_image.jpg[/img]
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?
 

Sim

Well-known member
#2
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?
 

Chris D

XenForo developer
Staff member
#3
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.
 

Sim

Well-known member
#4
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.
 

island

Active member
#6
I may as well ask here specifically as well as I have the same problem today, although I'm running apache as the webserver.

If there isn't an easy way to redirect the photopost jpg files to the imported xenforo /data/xenforo/ jpg files, I can archive the photopost /gallery/data directory. However, it appears in order to have XFMG use the /gallery route filter I have to move the gallery/data directory to archivegallery/data or else the XFMG /gallery route filter doesn't work.

Can someone help me with a good modrewrite rule to redirect
the old photopost image URLs

http://www.example.com/gallery/data/506/my_image.jpg
http://www.example.com/gallery/data/505/medium/Some_file.jpg
http://www.example.com/gallery/data/505/thumbs/another-c.jpg
to
/archivegallery/data/506/my_image.jpg
and so on...

without messing up the xenforo
/gallery
route filter that XFMG will now be under itself.