1.6 Compatible: Fetch remote posted images and store them locally
After brad brought up the idea of fetching remotely hosted images included in posts and hosting them locally, I decided to make a simple script to do just that that could be ran via a cron job.

The script can be found here: https://github.com/euantor/MyBB-Local-Images

To use it, you will have to modify the definitions at the top of the file to suit your site and I definitely don't recommend using it live without first trying it locally and backing up your database fully.

The script itself can be ran via cron job or accessed directly via your browser. Either way, it will simply output the number of posts that were modified.

There are several variables available that you can modify in the script such as whether to include the URL to the original source when swapping the image links, the upload path and the image URL path. The latter two are especially useful if you wish to store image files on a static subdomain or a CDN with a push zone.
brad-t likes this post