4 messages in com.googlegroups.google-desktop-developerDisplay image from URL
FromSent OnAttachments
Robert22 Jun 2008 18:56 
HemS22 Jun 2008 20:23 
James [GD Team]23 Jun 2008 00:18 
Robert23 Jun 2008 10:20 
Subject:Display image from URL
From:Robert (Prof@gmail.com)
Date:06/22/2008 06:56:41 PM
List:com.googlegroups.google-desktop-developer

I am struggling with getting images to display from a URL. This is what I have so far -

function LoadImage(ImageName) { var http = new XMLHttpRequest(); var url = "http://www.watkinsonline.com/images/products/ thumbnails/"+ImageName; http.onreadystatechange = onData; http.open("GET", url, "true"); http.send(); function onData() {

if (http.readyState == 4) { if (http.status == 200) { var source = http.responseStream; imageControl.src = source;

} else { // status != 200 imageControl.src = "placeholder.png"; } } } }

The imagename variable is read from an XML feed, and I have verified that the image file names are reading correctly. However, the function above does not display an image.

If I type the full URL in, it of course works. Also, if I type the filename in LoadImage("file.jpg") the image is displayed.

This is how LoadImage() is called -

//the section on reading the XML feed is omitted....this happens after the feed is parsed

var item_image = items[aa]['description'];

//for testing - shows the URL of the image, even if the image does not load link1.innerText=item_image; link1.href=item_image;

LoadImage(item_image);

Help would be greatly appreciated.

Thanks