WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Uploads by Proxy

For local development: Automatically load images from the production version of wp-content/uploads if they are missing locally.

Why would I want to use this?

Maybe you work on a site with gigabytes of images in the uploads directory, or maybe you use a version control system like SVN or Git, and prefer to not store wp-content/uploads in your repository. Either way, this plugin allows you to not worry about the uploads folder being up-to-date.

What is a production environment/site/server?

"Production" is a term that's used to refer to a version of a site that is running live on the Internet. If you normally edit your site through the WordPress code editor or over FTP, you are making edits on the production server. Editing your site in this way risks crashing the site for your visitors each time you make an edit.

What is a development environment/site/server?

"Development" refers to a version of your site that is in a protected area only accessible to you. Programs like MAMP, WAMP, and XAMPP allow you run a copy of your WordPress site in a way that is only accessible from your computer. This allows you to work on a copy and test changes without effecting the live site until you are ready to deploy your changes.

An image changed on my live server, but it didn't update locally.

This plugin only goes into action when an image is missing on your local copy. When it runs, it copies the file into your local wp-content/uploads folder and doesn't run again. If you'd like to update an image with the production copy again, delete your local copy.

What will happen if I enable this plugin on a live site?

Nothing. The plugin only takes action if it detects it is on a local development environment.

How does the plugin detect the difference between a production and development environment?

The plugin only loads if the server address and browser address are both 127.0.0.1. This should catch most local environments, such as MAMP, WAMP, and XAMPP.

If you want to run the plugin on a staging server, or have some other situation where you want to force the plugin to run, set define('UBP_IS_LOCAL', true); in wp-config.php.

Warning! Do not force UBP_IS_LOCAL to true on a production site! If if have any 404 requests for images in the uploads directory, it will cause PHP to go into an infinite loop until Apache kills the process. This could make your site run very slowly.

How does the plugin get around local DNS when production and development sites use the same domain?

It asks one of several remote servers what it thinks the IP address of your production domain is, then uses that IP to request the missing image. The correct domain name is sent in headers so that virtualhosts resolve.

What if I don't want my domain name sent to some third-party site?

You can define your own server that will return an IP address when given a domain name. In your WordPress install, you would put this in a plugin or functions.php:

add_filter('ubp_ip_url', 'ubp_ip_url', 10, 2);
function ubp_ip_url( $url, $domain ) {
    return 'http://yoursite.com/ip.php?domain='.$domain;
}

yoursite.com would be replaced with your own site address, and ip.php would contain:

<?php echo gethostbyname( $_GET['domain'] ); ?>

Where are those icons in the wordpress.org plugin header from?

Font Awesome

Requires: 3.1 or higher
Compatible up to: 3.6.1
Last Updated: 2014-3-10
Downloads: 1,244

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,2,2