2009年7月24日星期五

[GFW Blog] Imagoxy: A Picasa Image Proxy for Personal Website and Blog

作者:林健   来源:林健的BLOG

Picasa had been banned in Mainland China yesterday. I don't know if it is temporary or persistent. Lots of pictures on my blog are stored in Picasa. Unlike Flickr, I found it difficult to replace domain name or IP to pass the URL/IP filter. So I choose another way: download pictures from Picasa server to my Godaddy host, and replace the picture links in my posts from Picasa to my host. I wrote Imagoxy, a tiny PHP toolkit and Imagoxy-WP, a wordpress plug-in to implement this automatically and dynamically. This mechanism will certainly apply additional overhead and occupy more bandwidth. However, it is sustainable for my small website. Experiment shows it works well with wordpress 2.8.1. I make it open-source under a BSD license and you can get it from https://sourceforge.net/projects/imagoxy/.

Security issues should be considered carefully before it being used in significant applications. Some measures had been taken, but I hope you to review my codes and eliminate the hidden dangers. If you are interested in Imagoxy, welcome to join the small project at SourceForge and contribute your codes! Thanks. :)

Imagoxy Version 0.51 – Update: 2009/07/20
Imagoxy-WP Version 0.5 – Update: 2009/07/17

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 (e.g. Download pictures from Picasa on an unbanned US server and tranfer them to China's viewers where Picasa is banned sometimes).

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!




--
Posted By GFW Blog to GFW Blog at 7/24/2009 06:08:00 A
--~--~---------~--~----~------------~-------~--~----~
1、请点击www.chinagfw.org访问我们,订阅地址:http://feeds2.feedburner.com/chinagfwblog。2、需要Psiphon2注册邀请的朋友,请向english@sesawe.net发送电子邮件请求,说明 "can I have psiphon2 access" 并告诉您所在的国家。也可以使用Twitter Direct Messages或登陆Psiphon网站直接向Psiphon索取使用邀请。3、GFW Blog现提供最新翻墙工具下载(地址一、二、三),翻墙(突破网络封锁)方法介绍请见本站anti-censorship部分。4、本站热烈欢迎各位朋友投稿或推荐文章,请发邮件至chinagfwblog[at]gmail.com。5、敬请关注、支持、参与Sesawe和黑箱监管集体诉讼。
To unsubscribe from this group, send email to
gfw-blog+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/gfw-blog?hl=zh-CN
-~----------~----~----~----~------~----~------~--~---

没有评论:

发表评论