Hi folks,
I've a problem displaying a resized image in my gadget. I read the
content of the xml-file from my Webspace, parse it, choose a random
item and get then the url and the title of the photo to display.
This is the code snippet, that doesn't work properly for me:
....
_gel("photo").innerHTML = "<img id=\"pic\" src=\"photourl\" /img>";
//_gel("photo").innerHTML = "<img src='http://hermannsspace.de/joomla/
components/com_joomgallery/img_pictures/reisen_1/fuerteventura_3/
pic_from_fuerteventura_2_20071011_1133496455.jpg' /img>";
photo_H = document.getElementById("pic").height;
photo_W = document.getElementById("pic").width;
var photo_R = photo_H / photo_W;
if (photo_W > photo_H) { photo_W = 200; photo_H = parseInt(photo_W *
photo_R); }
if (photo_W < photo_H) { photo_H = 200; photo_W = parseInt(photo_H /
photo_R); }
document.images["pic"].height = photo_H; document.images["pic"].width
= photo_W;
_gel("text").innerHTML = "<div style='font-family:Verdana;font-size:
10' >" + phototitle + "</div>";
....
9 of 10 test runs display the right image, but that is resized to
24x24. Sometimes a properly resized photo (ca. 200px) is displayed. If
I'll remove the comment from the line 2 above and set _gel
("photo").innerHTML directly, it works without any problems and
resizes the photo as wished!
What am I doing wrong? Can anybody help me?
Thanks in advance!
Regards,
Hermann
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"iGoogle Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Gadgets-API?hl=en
-~----------~----~----~----~------~----~------~--~---