Powered By Railo

Wish List

My Amazon.com Wish List

Tags

adobe air ajax cf community cfml coldfusion examples ext flash flex javascript max2007 max2008 misc programming railo technology ui

Recent Entries

Wikipedia Raises 6 Million
30GB Zunes Self Destruct On New Years
Happy New Year
Server Move Update 2
Server Move

Currently Reading


Search

RSS


Subscribe

Enter your email address to subscribe to this blog.

Blogroll

An Architect's View
Ben Forta
CFSilence
Coldfusion Jedi
Rey Bango
TalkingTree



CFIMAGE Part 4: Remote Images

The Coldfusion 8 CFIMAGE tag allows you to work with remote images simply by providing a URL to the desired Image, this makes grabbing images from places such a flickr (which I use as an online backup of most of my images) easily.


<cfimage source="http://farm1.static.flickr.com/97/232021390_ad47422845_o.jpg" name="MyImage"/>
<cfimage source="#MyImage#" action="writeToBrowser"/>

This works just fine, even for really large images of 1368x2048. You can also manipulate your remote image in various ways there is one thing, however, you should be aware of when working with remote images.

Small Gotcha

I managed create a runtime error when trying to read the EXIF or IPTC meta data from the remote image.

Exception occured in JPG processing. segment size would extend beyond file stream length

This only occurred on big images, I tried with a fewer smaller images and CF had not problems.

Happy Coding...

Related Blog Entries

Comments
Steven Erat's Gravatar When "copying" remote domains or sources for display on another domain or other location, remember to respect the copyright notice. By default, all original images are implicity protected by copyright law, and unless stated otherwise they are not permitted to be reproduced or modified by anyone else.

Many Flickr photos associate Creative Commons licenses with particular images, and I believe that the Flickr API for developers allows you to restrict the results to images that are so licensed. The developer should make sure that the image usage complies with the requirements of the particular license on a photo, such as the Creative Commons 2.5 Non-Commercial, Attribution, Share-Alike which permits reproduction of the image so long as the purpose is not commercial, that the author is given proper credit, and that any reproductions bear the same license.

Important stuff!
# Posted By Steven Erat | 8/8/07 10:45 AM
Gary Gilbert's Gravatar @Steve,

Yes very important, thanks for posting that! It's definitely important to respect the copyright holder of the image.

I only used flickr as an example to illustrate the ability to use remote images and in no way would condone the improper use copyrighted images!

As I mentioned in my post I no only use flickr to show off my images to friends (and strangers alike) I also use it as off-site storage.
# Posted By Gary Gilbert | 8/8/07 10:58 AM
Gary Gilbert's Gravatar A work around to the image size problem when trying to get the EXIF data for remote images.

Use the <cfhttp> tag to retrieve the image and write it to the hard-drive. Then you can read in the image using the <cfimage> tag and get the EXIF data normally using the imageGetEXIFMetaData function. Do not use the <cfimage> tag to get the image and write it to disk as it loses the EXIF meta data.
# Posted By Gary Gilbert | 9/28/07 3:57 AM