mercredi 8 avril 2015

Reload image from directory only when image changed

I have an FTP server which gets an image pushed to it from an Android application of mine when a picture is taken from the camera. The image being pushed to the FTP server has the same name each time (testImg.jpg), so for each image that is captured and sent to the FTP server, the image gets overwritten.


What I'd like to do, is... display the image from the FTP directory to a webpage each time it is a new image, i.e. each time testImg.jpg is overwritten, reload the page to show new testImg.jpg image.


I've done very minimal work with Javascript, and I'm not too sure how to go about doing this. I feel really stuck and clueless.


This is what I have so far in my live.html file (very minimal and doesn't do anything but show an image...):



<html>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jquery-2.1.3.js"></script>
<body style="background-color:#eeeeee;">
<div id="imgdiv">
<img src="C:/inetpub/ftproot/testImg.jpg" id="img" onload="loadImg()" width="960" height="540">
</div>
<script type="text/javascript">

function loadImg() {
alert('Image loaded');
}
//img = new Image();
//img.src = "C:/inetpub/ftproot/testImg.jpg"

</script>
</body>
</html>


Any help is really appreciated!


Aucun commentaire:

Enregistrer un commentaire