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

Importing IPB Gallery to XFMG

Discussion in 'Media Gallery Support' started by Nuno, Jun 8, 2015.

  1. Nuno

    Nuno Active 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
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    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).
     
  3. Nuno

    Nuno Active Member

    Hi,

    This is specific to XFMG only, correct?
    I can't find in XF CP.

    This tool will change the actual path to the new path from all posts?

    Thanks
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    Nuno likes this.
  5. Nuno

    Nuno Active Member

    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.
     
  6. Nuno

    Nuno Active Member

    @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
     
  7. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  8. Nuno

    Nuno Active Member

    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.
     
  9. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  10. Nuno

    Nuno Active Member

    How are image names generated in xfmg?
     
  11. Chris D

    Chris D XenForo Developer Staff Member

    In a very different way.

    There's nothing in the file name that can actually identify an image in the database.
     
  12. Nuno

    Nuno Active Member

    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
     
  13. Chris D

    Chris D XenForo Developer Staff Member

    They will stay where they are. We copy them, rather than removing them. Hence my earlier comment:

     
  14. Nuno

    Nuno Active Member

    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... :)
     
  15. Chris D

    Chris D XenForo Developer Staff Member

    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).
     
  16. Nuno

    Nuno Active Member

    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?
     
  17. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  18. Nuno

    Nuno Active Member

    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?
     
  19. Chris D

    Chris D XenForo Developer Staff Member

    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
     
  20. Nuno

    Nuno Active Member

    Hi,

    When importing imagens, do images pass thru the resize process to match WxH and reduce quality?

    Thanks
     

Share This Page