Imagoxy - a PHP-based image proxy

2009-07-20

Imagoxy

Imagoxy ("image proxy") is a tiny PHP toolkit. It downloads pictures from remote server to local server and relocate corresponding http requests to the local one. It is used to access pictures when the remote server is banned or slow from the network of clients.

Licensed under a BSD license.

Install

  1. Modify Imagoxy 'getimg.php' file:
    • Set '$work_dir' to the location you wish Imagoxy works at.
    • Set '$cache_dir' to the location you wish files downloaded to. (default is OK in most cases)
    • Set '$error_file' as the file relocated to when access control denied. (default is OK in most cases)
    • Set '$reffer_list' as the legal HTTP_REFERER prefix list.
    • Set '$legal_type' as the legal file extension name list. (default is OK in most cases)
  2. Update the 'imagoxy' directory to your '$work_dir' and make the '$cache_dir' writable.
  3. Configure and deploy Imagoxy front-ends such as Imagoxy-WP.

Usage

  1. [ http://www.example.com/imagoxy/getimg.php?s={original URL} ] In this format (we called 'Imagoxy URL'), the http request will be relocated to a file on local server which is downloaded from the original URL. You can embed the Imagoxy URL into your <img src="..."> label. 'http://' in original URL is omissible and the other protocols are not allowed. Notice: as a parameter, original URL should be url-encoded again even if it has been url-encoded. e.g. 'Pic%20A.jpg' -- 'Pic%2520A.jpg'.
  2. [ http://www.example.com/imagoxy/getimg.php?u={encoded URL} ] Also does downloading and relocation. However, you should base64-encode, reverse and then url-encode the original URL. In PHP, these are done by 'urlencode(strrev(base64_encode($original_url)))'. This encoding method can pass the URL filter in certain regions.

Test

You can write a html page with an Imagoxy URL in <img src="..."> label. Open it locally, you should see the '$error_file'; after uploading it to the server with the URL prefix in '$reffer_list', you will see the relocated picture correctly.

Enjoy it!

Imagoxy-WP

Imagoxy-WP is a wordpress front-end for Imagoxy. Imagoxy downloads pictures from remote server to local server and relocate corresponding http requests to the local one. It is used to access pictures when the remote server is banned or slow from the network of clients. Imagoxy-WP now converts Picasa URLs to local Imagoxy URLs, and you can also add your customed conversion.

Licensed under a BSD license.

Install

  1. Download Imagoxy. Imagoxy is available at https://sourceforge.net/projects/imagoxy/.
  2. Configure and deploy Imagoxy on your server as Imagoxy's README file described.
  3. Modify Imagoxy-WP 'imagoxy-wp.php' file:
    • Set '$imagoxy_dir' to your Imagoxy location, which is the same as '$work_dir' in Imagoxy.
  4. Upload Imagoxy-WP php file or the whole directory to your wordpress '/wp-content/plugins' directory.
  5. Enable it in the dashboard.

After that, You will see:

<img src="http://lhX.ggpht.com/_WWW/XXX/YYY/ZZZ/sMMM/IMG_NNN.JPG" />

in your blog posts now becomes:

<img src="http://www.example.com/imagoxy/getimg.php?u=AABBCCDDEEFFGGHH" />

Since pictures are downloaded from your own server, it won't be banned then.

Enjoy it!