Resource icon

Unmaintained MetaMirror 1.6.1

No permission to download
Compatible XF 1.x versions
  1. 1.2
  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.webp

Verify this seems correct. Then Click on "Save Files", and re-run, you should get:

Simulated Test Only | Admin CP - Metabunk-2.webp

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.webp

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.webp


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.
  • Simulated Test Only | Admin CP - Metabunk.webp
    Simulated Test Only | Admin CP - Metabunk.webp
    35.6 KB · Views: 460
  • Options_ MetaMirror Image Reshosting | Admin CP - Metabunk-2.webp
    Options_ MetaMirror Image Reshosting | Admin CP - Metabunk-2.webp
    76.7 KB · Views: 430
Author
Mick West
Downloads
351
Views
2,535
First release
Last update

Ratings

5.00 star(s) 23 ratings

More resources from Mick West

Latest updates

  1. Fixed bug with malformed .PNG files

    Minor bug fix for rare cases when older external PNG files had been corrupted, causing...
  2. Flagging of broken image links

    Added an option (off by default) to flag broken IMG links with a message, and convert the IMG...
  3. Resource manager support and scrambled names

    - Fixed sig images ignoring flag on instant rehosting - Added option to rehost images used...

Latest reviews

This addon prevents dead image links and leeching off other sites. It works great on my big board.

Thanks so much Mick!
amazing resource, saved me hours and hours and otherwise mindless searching.. thank you very much! :)
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!
Great Add-on!
very useful and a must have I would say, thank you!
Lovely Stuff :)
very useful!
i hope version compatible with 1.3.0 thank you.
can u update it to 1.3
Mick West
Mick West
I'm using it on 1.3, and it seems to work fine.
A very usefull addon. Thank you very much...
Top Bottom