PDA

View Full Version : script for webcam image zoom in/out refresch time ?


opabert
04-06-2005, 12:30 PM
Hello to all,

My name is Bert and iam new on this board.
I'am totaly not a PC goeroe but like to build a webpage using a webcam. I use coffeecupwebcam program upload with FTP but also have program webcam32 using realstream video.

Is use a script to refresch image. Also on this page i found a script to zoom in and out but these script not working together. Also found some java push/pull applets coming with webcam32.

My question for the experts;
Is it possible to find or make a script that refresch the uploaded image and also able to zoom in and out in same time?

Thank you for time to reply,

Bert.

ronaldb66
04-06-2005, 12:52 PM
Bert,

Welcome; could you give some more insight into the scripting used, preferably including the page it is included in? I reckon it's possible to use them next to eachother, but there may be a little tweaking needed.

opabert
04-06-2005, 02:05 PM
Bert,
Welcome; could you give some more insight into the scripting used, preferably including the page it is included in? I reckon it's possible to use them next to eachother, but there may be a little tweaking needed.

Iam totally not a html or java goeroe ;) Its still running on my local machine not yet oploaded to the webcam page.
Iam not a PC goeroe but i try several scripts and applets coming with coffecup and webcam32 also found some on other places. If you like i could send some samples via email.

Grtx,
Bert.

chilipie
04-06-2005, 02:07 PM
It would be better if you posted the code here, so that more people could help out.

And BTW, the word's "guru" ;) .

opabert
04-06-2005, 02:47 PM
chilipie and ronald
Thank you for the reply,

There some applets and scripts i found and tested the last days.

What i like to do is:
- Upload FTP or real webcam.jpg picture,
- refresch is every ..... secs by me to setup timer,
- and to zoom in and out that picture i uploaded.

I found 2 applets and 1x java script to do the refresch part. Also on http://www.javascriptkit.com i found 1x java script zoom function but this script not stay in the proper width/height, but it zoom. When posible i like both functions together and maby by using the mouse left / right button to zoom in / zoom out.

Or is someone know a source for a applet that do both, will be fine. (javaclass or some like). I do not know if this is possible but any help will be very much appriciated.

Thank you,
Bert.

Here is 1x refresch applet and 1x refresch java script
And under 1x zoom java script

<APPLET code="JavaCam.class" width=352 height=288>
<PARAM name="url" value="webcam1.jpg">
<PARAM name="interval" value="6">
</APPLET>



<script LANGUAGE="JavaScript">
<!--
browserType = navigator.appName;
newImage = new Image();
document.onstop = document_onstop;

function startstop_onclick()
{
if (startstop.value == "Stop")
{
stopLoad();
}
else
{
startstop.value = "Stop";
newImage.onload=loadNewImage;
loadNewImage();
}
}

function document_onstop()
{
stopLoad();
}

function stopLoad()
{
newImage.onload="";
startstop.value = "Start";
window.status = "Live video stopped ...";
}

function loadNewImage()
{
uniq = new Date();
uniq = uniq.getTime();
document.images.zoomkat1.src=newImage.src;
newImage.src="webcam1.jpg/webcam/image.fcgi"+uniq;
window.status = "Displaying live video ...";
}
function initialImage()
{
uniq = new Date();
uniq = uniq.getTime();
newImage.onload=loadNewImage;
newImage.src="webcam1.jpg/webcam/image.fcgi"+uniq;
document.images.zoomkat1.onload="";

}

{
document.write('<IMG SRC="webcam1.jpg/webcam/image.fcgi" name=zoomkat1 onload="initialImage()" width=320 height=240>');
}
//-->

</script>



=================================

ZOOM not stay in proper image width / height

=================================

<script language="JavaScript1.2">

//Image zoom in/out script- by javascriptkit.com
//Visit JavaScript Kit (http://www.javascriptkit.com) for script
//Credit must stay intact for use

var zoomfactor=0.05 //Enter factor (0.05=5%)

function zoomhelper(){
if (parseInt(whatcache.style.width)>10&&parseInt(whatcache.style.height)>10){
whatcache.style.width=parseInt(whatcache.style.width)+parseInt(whatcache.style.width)*zoomfactor*pre fix
whatcache.style.height=parseInt(whatcache.style.height)+parseInt(whatcache.style.height)*zoomfactor* prefix
}
}

function zoom(originalW, originalH, what, state){
if (!document.all&&!document.getElementById)
return
whatcache=eval("document.images."+what)
prefix=(state=="in")? 1 : -1
if (whatcache.style.width==""||state=="restore"){
whatcache.style.width=originalW
whatcache.style.height=originalH
if (state=="restore")
return
}
else{
zoomhelper()
}
beginzoom=setInterval("zoomhelper()",100)
}

function clearzoom(){
if (window.beginzoom)
clearInterval(beginzoom)
}

</script>

</head>

<body text="#FFFF22" bgcolor="#7080a0" link="#5Fff5F" vlink="#553A9B" alink="#FF8000">

<TABLE BORDER=0 CELLPADDING=20 CELLSPACING=0 WIDTH="98%">
<TR><TD BGCOLOR="#808080" align="center">
<!-- CHANGE 99 to your image width, 100 to image height, and "myimage" to your image's name-->
<a href="#" onmouseover="zoom(99,100,'myimage','in')" onmouseout="clearzoom()">Zoom In</a> |
<a href="#" onmouseover="zoom(99,100,'myimage','restore')">Normal</a> |
<a href="#" onmouseover="zoom(120,60,'myimage','out')" onmouseout="clearzoom()">Zoom Out</a>
<div style="position:relative;width:99;height:100"><div style="position:absolute">
<img name="myimage" src="webcam1.jpg" align="center">
</div></div>
</TR></TD>
</TABLE>
<p align="center"><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://www.javascriptkit.com">JavaScript
Kit</a></font></p>

opabert
04-13-2005, 11:42 AM
Hello to you all,

I see all kind of script floating arround is somone willing to help me out, please, i appricated?

Thank you for your time.

Bert.