<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery.exif.js"></script>
<title>test.html</title>
</head>
<body>
<div id="imagediv">
<img src="images/00000036.jpg" width="900px" id="imgA" exif="true" />
</div>
<script>
// This cript should automatically display the exif info of the image. Without user interaction.
// However it only works when the image is clicked.
//
// EXIF Code from http://www.nihilogic.dk/labs/exifjquery/
// FAILING:
document.getElementById('imagediv').innerHTML +="<br \/\>GPSLatitude: " + $("#imgA").exif("GPSLatitude");
// WORKS:
$("#imgA").click(
function() {
document.getElementById('imagediv').innerHTML +="<br \/\>GPSLatitude: " + $("#imgA").exif("GPSLatitude");
} // end function
) // end click
</script>
</body>
</html>
<html>
<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery.exif.js"></script>
<title>test.html</title>
</head>
<body>
<div id="imagediv">
<img src="images/00000036.jpg" width="900px" id="imgA" exif="true" />
</div>
<script>
// This cript should automatically display the exif info of the image. Without user interaction.
// However it only works when the image is clicked.
//
// EXIF Code from http://www.nihilogic.dk/labs/exifjquery/
// FAILING:
$(document).ready(function(){
//put stuff here to run as soon as DOM loads
document.getElementById('imagediv').innerHTML +="<br \/\>GPSLatitude: " + $("#imgA").exif("GPSLatitude");
});
// NOW FAILING TOO:
$("#imgA").click(
function() {
document.getElementById('imagediv').innerHTML +="<br \/\>GPSLatitude: " + $("#imgA").exif("GPSLatitude");
} // end function
) // end click
</script>
</body>
</html>
I already added it. And uploaded it.
However it doesn't help:
Code:
$(document).ready(function(){
//put stuff here to run as soon as DOM loads
document.getElementById('imagediv').innerHTML +="<br \/\>GPSLatitude: " + $("#imgA").exif("GPSLatitude");
});
I think your exif() code needs the image file to be fully loaded in order to read it. Since $(document).ready() doesn't wait for this, and runs only when the page DOM is loaded, it's failing. Try replacing
Dunno. There's stuff in there that would seem to handle images not being fully loaded, so I have no idea why it's not firing. Have you tried it with different images? With several images on the page? The only thing I could suggest at the moment is that you run the exif-fetching function manually: