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
- Compatible XF Versions:
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.
is rehosted locally, the post modified as:
Or (optionally) as an attachment.
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:
Verify this seems correct. Then Click on "Save Files", and re-run, you should get:
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:
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:
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.
Locally rehosts any external [IMG] files (optionally as attachments) and updates links