Reginald Johnson wrote:
I'm trying display a popup on the mouseover of a jpeg image.
I'm thinking of trying to populate the popup with text obtained
from the image metadata. However, I haven't been able to find
any information on how to do this with javascript. Is there a
way to access image metadata with javascript.
Client-side javascript cannot do that as the browser object models do
not expose the data contained in image files loaded into Image objects
or IMG elements. In principle it may be possible to use an XML HTTP
request object to load an image file and then extract the data from
the - responseText -, but having image data interpreted as utf-8 encoded
text and then trying to extract information from the resulting
javascript string is going to be horrendously difficult. Indeed, it
would be more practical to have a server-side resource extract the
information and package it in a form suitable for an XML HTTP request,
and then request the information indirectly.
But, if the information is to be extracted on the server it may as well
be extracted as part of the initial request and included in the page
that displays the images with the mouseover.
Richard.