[Flashr] image smooth
maja kalogera
maya at kalogera.net
Tue Mar 27 07:19:01 EST 2007
T
H
A
N
K
S
----- Original Message -----
From: Mario Klingemann
To: Flashr at osflash.org
Sent: Tuesday, March 27, 2007 11:42 AM
Subject: Re: [Flashr] image smooth
The only way to work with BitmapData + flickr (or any other external images) at the moment is to use a server-side proxy. By this you trick flash into thinking that the image comes from your own domain and not from an external one.
This can be done in several ways - my preferred one works with Apache which needs two modules activated: mod_rewrite and mod_proxy.
Then just add a .htaccess file to the same folder where your swfs html page resides that contains the following 2 lines:
RewriteEngine on
RewriteRule ^myLittleOpenProxy/(.+) http://$1 [P,L]
When you now try to open a URL on your server which is formed like this:
http://www.yourserver.com/myLittleOpenProxy/static.flickr.com/36/149865049_f024321247_m.jpg
Your request will be redirected to http://static.flickr.com/36/149865049_f024321247_m.jpg but flash will render it to a bitmap
WARNING: There is a catch, because in this form can be abused as a proxy for just any site, so people
could also call http://www.yourserver.com/myLittleOpenProxy/www.anotherwarezandpr0nsite.org/illegal.zip
and download via your site from http://www.anotherwarezandpr0nsite.org/illegal.zip
So you might want to limit the access to flickr only. for example like this:
RewriteEngine on
RewriteRule ^flickrProxy/(.+) http://static.flickr.com/$1 [P,L]
This you would call like that:
http://www.yourserver.com/flickrProxy/78/162016635_ebd60ba4d4_o.jpg
which will translate into
http://static.flickr.com/78/162016635_ebd60ba4d4_o.jpg
If you cannot install the required apache modules on your server there is an alternative. You can use a PHP script to do the proxying:
flickrproxy.php:
<?php
$feedURL = $_GET['url'];
$feedURL = trim($feedURL);
$ch = curl_init($feedURL);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
This would be called like this:
http://www.yourserver.com/flickrproxy.php?url=http://static.flickr.com/24/98249100_d2bc34111d_m.jpg
But again you might want to limit the range of allowed urls with a regular expression in order not to open up an open proxy.
Cheers
Mario
--
Mario Klingemann / Quasimondo
Computational Artisan
http://www.quasimondo.com
Kelvin Luck schrieb:
Gábor Tátrai wrote:
Hi All,
I'm newbie here from Hungary. I have an error after onLoadInit my images.
I'd like to use bitmapdata and attachBitmap to smooth my images, but it
doesn't work, because of an Security Sandbox Violation error. Has anyone
had the same problem? Is there any cure?
Thanks for your answer! Gabor.-
Hi,
I'm afraid other people have had the same problem and there doesn't
currently appear to be any way around it. I suggested a possible
workaround to the flickr team here:
http://tech.groups.yahoo.com/group/yws-flickr/message/2289
What I might do is actually produce the swf I suggest there and post it
somewhere as a live demo and then ask again on the flickr mailing list,
Cheers,
Kelvin :)
_______________________________________________
Flashr mailing list
Flashr at osflash.org
http://osflash.org/mailman/listinfo/flashr_osflash.org
------------------------------------------------------------------------------
_______________________________________________
Flashr mailing list
Flashr at osflash.org
http://osflash.org/mailman/listinfo/flashr_osflash.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/flashr_osflash.org/attachments/20070327/35ce740f/attachment-0001.htm
More information about the Flashr
mailing list