IgniteWeb
asked on
Reload Webcam Images by Port Number
Hi everyone, first time-long time, so be gentle. :)
When users log into our warehouse website, they can view specific webcams as designated by their account permissions. Each webcam FTPs one image every second to a predetermined image directory and has a different image name based on its port (ex. "80021.jpg", "80022.jpg", etc.)
Using a PHP recordset, I'm loading one camera image at a time, based on permissions, and that's working great. But using Javascript I want to refresh the images every 2 seconds without refreshing the page.
My problem is I need to tell the Javascript newImage function (see below) what the image is called (ex. "80021.jpg", "80022.jpg", etc.) based on the PHP recordset.
(Javascript to reload the image:)
<script type="text/javascript">
function newImage(){
if(document.images){
document.images['camImage' ].src =**CAMERA-SPECIFIC IMAGE NAME HERE??** + '.jpg?' + Date.parse(new Date().toString());
}
setTimeout(newImage,5000);
}
</script>
(Image call in the html body:)
<img name="camImage" src="<? echo $aCams[$iCount]['iPortNumb er']?>.jpg " />
Admittedly this kinda thing is new to me, so if I need to bark up another tree, let me know.
When users log into our warehouse website, they can view specific webcams as designated by their account permissions. Each webcam FTPs one image every second to a predetermined image directory and has a different image name based on its port (ex. "80021.jpg", "80022.jpg", etc.)
Using a PHP recordset, I'm loading one camera image at a time, based on permissions, and that's working great. But using Javascript I want to refresh the images every 2 seconds without refreshing the page.
My problem is I need to tell the Javascript newImage function (see below) what the image is called (ex. "80021.jpg", "80022.jpg", etc.) based on the PHP recordset.
(Javascript to reload the image:)
<script type="text/javascript">
function newImage(){
if(document.images){
document.images['camImage'
}
setTimeout(newImage,5000);
}
</script>
(Image call in the html body:)
<img name="camImage" src="<? echo $aCams[$iCount]['iPortNumb
Admittedly this kinda thing is new to me, so if I need to bark up another tree, let me know.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your expertise. much appreciated!
Open in new window