Importing IPB Gallery to XFMG

Nuno

Well-known member
Hello,

I didn't brought XFMG yet, but would like to know when importing images from IPB Galery where (path) images are stored?

Regarding posts with embeded images (via media or url tag) will they be updated?

Thanks
 
The images are stored in the /data and /internal_data directories - the same place as all attachments.

Post content wouldn't be updated - you would either have to manually update it using the post content replace tool, or implement redirects (if possible).
 
Hi,

If images are moved from IPB path to XF path this must be done, if not, posts with embeded images from gallery will lost all photos.
 
@Brogan

Can you share with me how the conversions are made retaining the ids?

Taking the example bellow, how is the conversion made so I can understand what I need to do to replace embedded images in posts.

Code:
ALBUMS

Link to Album Page: http://www.example.com/gallery/album/289-album-name/

PHOTOS

Link to Photo Page: http://www.example.com/gallery/image/9057-photo-name/
Link to Image: http://www.example.com/uploads/gallery/album_289/gallery_10431_289_1876092.jpg

Thanks
 
In XFMG:

Link to Album Page: http://www.example.com/gallery/albums/289
Link to Photo Page: http://www.example.com/gallery/9057

Some notes:
  • The album name / photo name are superfluous so for the purposes of redirection, you don't need to worry about them.
  • By default, the XFMG default route is "media" not "gallery" but changing it to "gallery" is simple. You can do this by editing the "xengallery => media" route filter in Admin CP > Route Filters.
The link to the image is much trickier. Actually, there's no programmatical way of redirecting these links because these reference files on the file system. Solutions include leaving the old files on the file system, or use an add-on (several exist) to convert these linked files to attachments.
 
Hi,

Thanks for you input.

Image link is very important, other than that I must leave all images where they are and duplicate then when importing to XFMG :(

I'll evaluate these options.
 
That's just the nature of hard coded links to files, unfortunately.

There aren't many reasonable solutions aside from the ones I mentioned, unfortunately.
 
Hello,

When we import the images, will those stay in the file path where they are now or you move it to xf data folder with a new name?

Thanks
 
I assumed you won't delete it.

In the import log do we have a column with the old name and another column with the new name? If not, could this be added?

If we had this, than we could write a mysql query to replace the old image with the new one.

We would need a simple script to UPDATE posts_table SET post_field = REPLACE(post_field, $old, $new).

This would work... :)
 
No, we just store the old ID and the new ID and it's not something we can change.

If the original photo ID is stored in the file name somewhere, it should be possible to extract that using a regular expression in the Post Content Find and Replace tool and rewrite the URL to something that would work with the new gallery.

e.g. if this is the old file name:
Code:
gallery_10431_289_1876092.jpg

And 10431 is the photo ID (I'm not certain it is, this is just an example)

Then a comparable URL in the new Gallery would be:
Code:
gallery/10431/full

This isn't ideal. It's replacing a direct link to a file with a link to the full image within the gallery, e.g. the gallery/<id>/full URL will be subject to various permissions checks, queries need to be run to fetch it from the database etc. and so there's more of an overhead to display that image and if the viewing user has no permissions to view it then the image will appear broken to them (that URL will return a 404 or a 403 if it's not viewable).
 
Hi,

This is what I see: gallery_{member_id}_{album_id}_{dont_know_what_this_is}.jpg
Does the import logs have a column with the ID of the original image and a column with the id of the new image?
 
That is all the import logs contain. The content type, old ID and the new ID.

If those URLs do not contain the photo ID/media ID it will not be possible to do what I mentioned in my previous post.
 
That is all the import logs contain. The content type, old ID and the new ID.

If those URLs do not contain the photo ID/media ID it will not be possible to do what I mentioned in my previous post.

No it doesn't, but I in the XFMG I have the image_id and the name of the file. Is so, we could have a table with:

|old_id|old_file_name|new_id|new_file_name|

Than we just need a php shell script that would query this table to get the old/new file name and regex/replace the file name :)

Should this be possible?
 
The new file name actually won't be useful.

XenForo attachments aren't actually directly accessible via a URL. That'd look something like this:
Code:
internal_data/attachments/3/3325-9e5a2b2d872b033cda35c9ef0b4d1306.data

As I said before, the import log only stores content type, old ID and new ID and that's not something we can reasonably change. Certainly any customisation or custom import log is beyond the scope of what we can reasonably support.

The import log is somewhat superfluous if you retain content IDs so it's perhaps not strictly useful if you choose that option.

The key, though, is working out how the old file names are generated. If you can query the old file name, get the old ID and you retain the content IDs then the new URL would simply be:

Code:
gallery/<old_id>/full
 
Back
Top Bottom