Hi Hermann,
The major thing that jumps out at me from your code snippet is that
early on you're referring to the photo element by _gel("photo"), then
later you use document.images["pic"]. Are these the same HTML element?
Minor(?) thing: your resizing tests won't work for any square photos
(H = W).
Could you post a link to the live gadget instead of a snippet? There's
lots that we can't tell from just looking at this (HTML, photo
dimensions, other JS) that could be influencing this. Plus it's vastly
easier to debug a real example.
String
On Jun 12, 12:32 pm, Hermann <[email protected]> wrote:
> 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
-~----------~----~----~----~------~----~------~--~---