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

MetaMirror 1.6.1

Locally rehosts any external [IMG] files (optionally as attachments) and updates links

  1. Mick West
    Compatible XF Versions:
    • 1.2
    • 1.3
    This is currently a ONE-WAY conversion of image links from external to local, there is no undo. Make sure you understand this before you install this add-on

    The ability for users to externally link images is very useful, but can lead to problems down the road if the image that they link to is deleted from the server, or if it's moved, or if the server goes offline, or if the linked image has limited bandwidth.

    MetaMirror ensures this never happens by automatically finding external links, downloading the file to your local server, and altering the link to point to the local version.

    For example:
    [IMG]http://upload.wikimedia.org/wikipedia/commons/6/63/Wikipedia-logo.png[/IMG]

    is rehosted locally, the post modified as:
    [IMG]http://metabunk.org/data/MetaMirrorCache/upload.wikimedia.org_wikipedia_commons_6_63_Wikipedia_logo.png[/IMG]

    Or (optionally) as an attachment.

    [attach=full]1234[/attach]

    This ensures the image lasts as long as your forum does. It can also speed things up, depending on your server configuration.

    Install in the usual way. Caching is initially disabled to let you to test it and set ignore strings. Cron job is initially set to run every five minutes. You can change how many posts are processed per run.

    A problems had been reported with using an SSL proxies like go-camo (which is used to suppresses mixed-content warnings), so I'd suggest removing that before running. Once all images are local, you will not need it anyway.

    Detailed Installation Instructions:

    Step 1: Upload and Install

    Upload the contents of the the upload folder to your Xenforo installation location. So you should have library/Metamirror/...

    Install the add-on via the addon-MetaMirror.xml file.

    Step 2. Configuration

    Go to Options -> MetaMirror Image Rehosting
    Do not enable it yet

    Add any ignore strings. This would be any different host you use for images, or a CDN, or just a site or dynamic image url you want to ignore.

    Add Exclude forums - if you don't want a forum to be scanned, then add the forum ids here.
    Do not enable it yet
    Step 3: Testing


    Go to Tools -> MetaMirror Tester (in the left sidebar menu)

    [NOTE: The following is for linked images re-hosted as files. If you use the attachments system, then the "Rehosted URL" will point to a temporary file, and then to the attachment after you commit the changes]

    Verify that the data rehosting path and the file reference path are correct.

    Leave the "Commit Changes" and "Save Files" options unchecked, and click on "Proceed" to run a non-destructive test.

    Assuming you have some images to rehost, you will get something like:

    Simulated Test Only | Admin CP - Metabunk-1.jpg
    Verify this seems correct. Then Click on "Save Files", and re-run, you should get:

    Simulated Test Only | Admin CP - Metabunk-2.jpg
    Notice the Rehosted URLs are now active links. Click on the link to make sure the image has been rehosted correctly, and is web accessible at that URL.

    Then click on "Commit Changes" and Proceed, you should get:

    Committing Changes! | Admin CP - Metabunk.jpg
    The bytes downloaded are listed as zero, as you have already downloaded the file. Now just verify the that post has been modified (go to http://example.com/posts/[post number]

    Check the image displays, and that it's actually using the local URL.

    You should then try a few more times, look at the URLS, and ensure things are working.

    If you want, you can temporarily increase the number of IMG posts scanned per run with "Override per-run", so you can see what a reasonable maximum is for your server. Or if you just want to convert a bunch of links manually.

    If all seems well you, can enable MetaMIrror in the options, like this:
    upload_2013-9-6_16-47-46.png

    Troubleshooting:

    The most likely thing that can go wrong is the URL of the rehosted files will be incorrect. There are two things that might be going on here:

    1) Check Options -> Basic Board Information -> Board URL
    This should point to the urls of the folder that your data directory is in.

    2) Check library/config.php
    You might have something like:
    $config['externalDataUrl'] = 'http://example.com/data';
    That should work, but also might be corrupt.

    If the Board URL seems correct, but your data is in a different place, then you could try manually overriding it in $config['externalDataUrl']

    If things get REALLY messed up (unlikely, but if you rush in....), then you might be able to write a tool to revert things using internal_data/MetaMirror.log, which contains the post number, the original link and the modified link. A future release may include this "undo" functionality.

    Please let me know if you have problems.

    Images

    1. Simulated Test Only | Admin CP - Metabunk.jpg
    2. Options_ MetaMirror Image Reshosting | Admin CP - Metabunk-2.jpg
    Xorex Xor, SAS1024, vinafix and 11 others like this.

Recent Reviews

  1. NSL
    NSL
    5/5,
    Version: 1.6.0
    Great Add-on!
  2. johnny82
    johnny82
    5/5,
    Version: 1.6.0
    very useful and a must have I would say, thank you!
  3. Mark3121
    Mark3121
    5/5,
    Version: 1.6.0
    Lovely Stuff :)
  4. Shyuan
    Shyuan
    5/5,
    Version: 1.6.0
    very useful!
  5. jamalfree
    jamalfree
    5/5,
    Version: 1.6.0
    i hope version compatible with 1.3.0 thank you.
  6. Mishal
    Mishal
    5/5,
    Version: 1.6.0
    can u update it to 1.3
    1. Mick West
      Author's Response
      I'm using it on 1.3, and it seems to work fine.
  7. Designbox
    Designbox
    5/5,
    Version: 1.6.0
    A very usefull addon. Thank you very much...
  8. SelfSufficientMe
    SelfSufficientMe
    5/5,
    Version: 1.5.0
    Great add-on & top instructions! My main forum isn't very old but I'm already missing the odd image from broken links this has ensured it stops happening - thanks mate!
  9. cmeinck
    cmeinck
    5/5,
    Version: 1.5.0
    This is an amazing add-on. Having an older forum, I've been seeing images from sharing sites drop off regularly creating broken URLs. This has helped me host images within my site. Fantastic!
  10. dwdmadmac
    dwdmadmac
    5/5,
    Version: 1.4.4
    Awesome! I actually have always wanting something like this. Can't believe there is a addon for it!! So Stoked! Thanks again for providing this free!