IMG tag with local reference

1,324 views
Skip to first unread message

Pedro_Katzenstein

unread,
Nov 23, 2006, 11:13:15 AM11/23/06
to KML Discussions
When using the html tag <img> in the data/description kml tag, the source element only accepts absolute/external references (full path):
<img src="c:/root/tests/images/xyz.jpg"> or
<img src="http://www.site.xxx/images/xyz.jpg">

instead like the kml tag <icon> that also accepts local references:
<icon>images/xyz.gif</icon>

What I need is this:
<img src="images/xyz.jpg">
that html supports, but Google-Earth 4.0.2091 (beta) seams not.

Is it so? or am I doing something wrong?
Because local references are usefull when the images are stored in the same server. Before uploading from PC to the server I must allways beware that changes...

Can anyone help me on that?

LuciaM

unread,
Nov 23, 2006, 8:38:14 PM11/23/06
to KML Discussions
I don't know if this is the only thing affecting you, but the folder within the kmz file produced by GE which holds the images is now named 'files' rather than 'images'.

If you are manually adding image files to the kmz using "images/pic.jpg" I don't think it will recognize the images.

Pedro_Katzenstein

unread,
Nov 24, 2006, 4:58:37 AM11/24/06
to KML Discussions
Thanks for replying.

In a .kml file I have this code:

...
<Placemark>
<description>
<!CDATA[
<img src="imagens/X-FBugio.jpg" width="123" height="63"><br>
<b>Bugio</b><br>
<b>Lat:</b>38º 39,70' N<br>
<b>Long:</b>9º 17,85' W<br><br>
Local: Foz do rio Tejo/Forte de S.Lourenco<br>
Altura: 14 m<br>
Altitude: 28 m<br>
Alcance: 21 M<br>
Periodo: 5 s<br>
Luz: Verde - Lt 1s; Oc 4s<br>
Codigo Int.: 2126
]]>
</description>
<name>Bugio</name>
<Snippet/>
<Style>
<IconStyle>
<color>e5ffffff</color>
<scale>0.35</scale>
<Icon>imagens/X-Farolvd.gif</Icon>
</IconStyle>
<LabelStyle>
<scale>0.75</scale>
<color>ffffffff</color>
</LabelStyle>
</Style>
<Point>
<coordinates>-9.299030556,38.66052222,0</coordinates>
</Point>
<LookAt>
<longitude>-9.299030556</longitude>
<latitude>38.66052222</latitude>
<range>15000</range>
</LookAt>
</Placemark>
...

if I alter the image line to
<img src="http://katzenstein.planetaclix.pt/imagens/X-FBugio.jpg" width="123" height="63">
it works weell, but it should (according the html rules) work the otherway.
If I change the server you can imagine that all references to this server must be changed to the other one.
I don't know if I am doing something wrong, or a bug, or a GE limitation.

All my images are in that folder (like the icon tag image).

Even so I will try to change the folder to «files» and see whats happen.
Tanks again
PedroK

Pedro_Katzenstein

unread,
Nov 25, 2006, 1:34:39 PM11/25/06
to KML Discussions
Bad luck until now.
I've tried and I am still as in the begining.
I searched also before for some posts and I found nothing about it.

The img tag seems to not admit else than the full path either
http://server/etc. or
c:/folder/etc.

If someone can help me ...

ink_polaroid

unread,
Nov 25, 2006, 2:25:10 PM11/25/06
to KML Discussions
The relative path "images/foo.jpg" only works inside a KMZ file. If you use a Zip utility (like winzip) to create an archive, your .kml file can reference other subfolders using these relative paths.

If you want to reference anything from a simple KML file, then you have to use absolute (full) paths.

simon_a

unread,
Nov 25, 2006, 2:42:10 PM11/25/06
to KML Discussions
Hello,

That's what I would have thought, so I had a play with it and found that relative paths work for me

The only difference is that I'm using the newer 4.0.2416 release.

Maybe I've missed something(?)

EDIT: I tried this again today and this time it didn't work. My guess is that there is some caching going on and that was the reason it seemed to work before.



Simon.

Pedro_Katzenstein

unread,
Nov 26, 2006, 3:09:41 PM11/26/06
to KML Discussions
But relative paths works weel with the icon tag. Only with the IMG SRC not.
I am not calling from KMZ files, but invoking KML. Even when I run it in my PC I must invike the full path.

Maybe in a newer version that can be possible.

Thanks for the Help!

mhache

unread,
Dec 12, 2006, 1:58:56 PM12/12/06
to KML Discussions
I have been running into a similar situation.
I actually was able to get relative links to work for images, for example this works for me:
<img src="..\googleearth.gif" />

However, it does not work for links. The following Does NOT work:
<a href="..\googleearth.gif">Link to Image</a>

The code above was placed in the <Placemark><description> tag of the KML file.

What I am trying to do is link to files using a link relative to the location of the kml file. All my files are stored locally, and not on a web server.

By the way, I am using Google Earth 4.0.2416 (beta).

Thanks.

simon_a

unread,
Dec 12, 2006, 3:23:22 PM12/12/06
to KML Discussions
Hello,

Had GE already displayed that image before you got the <img> tag to work?

I thought I'd got it to work too but I think it was actually caching the image from a previous version of the code I used. When I went back to check later, it wou;dn't display.



Simon.
Reply all
Reply to author
Forward
0 new messages