Phil Wherry: update: have working code; now need to make it a little easier to use. Phil Wherry: amazingly, the code to do this turned out to be two lines long. Phil Wherry: well, that was the proof-of-concept. the actual version will probably be 20 lines or so when done. drofnasw: You know that we're going to save 640x480 images from the Webcam, right? Would like to be able resize 'em to 320x240 and 160x120. Can do? Phil Wherry: scales available will be 1/2, 1/4, and 1/8 (i'm using the cjpeg/djpeg tools as the guts of the tool; that's what they can do) drofnasw: 320x240 is 1/2; 160x120 is 1/4. Phil Wherry: yep, so it'll work fine. drofnasw: Beautifully! drofnasw: I see a file called "resizer.php" has appeared in the webcam/earthdial directory -- does that mean that the utility will work only in that directory? Phil Wherry: it'll work in the directories in which it appears (i.e. you'll want to copy it elsewhere. It needs to be in the same directory as the files upon which it operates for security reasons. drofnasw: But I can copy it into any directory -- incl. my own Webspace -- right? Phil Wherry: yes. let me get it done and i'll give you some lessons on it. Phil Wherry: Have a look at this: http://www.wsanford.com/webcam/earthdial/resizer.ph p?filename=fcps-earthdial.jpg&scale=2 Phil Wherry: The scale factor at the end can be either 2 or 4 or 8. drofnasw: O.K., I tested all sizes (2, 4, 8). Works well! One mystery: where are the files that the resizer generates? I don't see any new files in the directory. Phil Wherry: It's not creating new files; it's generating the JPEG data on the fly and sending it to the browser without creating an intermediate file. drofnasw: Extraordinary! And this will also work w/in the tag? Phil Wherry: Yes, it will work anywhere you can use an image. Phil Wherry: This does bring me to an important point, though: the file has to be in the same directory. If the filename is wrong, the tool will just silently fail; there's nothing in the way of error messages since it's generating an image. drofnasw: My colleague Gary runs a Webcam in his pltrm. -- could he copy the PHP file and run it on his Webserver? Phil Wherry: Doubtful. It depends on the existence of the cjpeg and djpeg tools (Unix), which are doing the hard work. In addition, the Web server has to understand how to handle PHP scripts. drofnasw: No problem re: error msgs. -- the files will be named consistently, so the utility should not fail. Phil Wherry: no problem - just pointing out that when you get the "broken image" icon when testing, that's probably what's wrong. drofnasw: Do you think we should save Webcam images to a separate subdirectory? Phil Wherry: Full invocation sequence is: resizer.php?filename=filename&scale=x&quality=y scale is 2, 4, or 8; quality is 0-100. Defaults are 2 and 90, respectively. No default for the filename. Phil Wherry: Don't think it matters, to tell you the truth. drofnasw: "Quality" as in JPEG compression? Phil Wherry: correct. drofnasw: Please send me another sample URL that includes all specs., incl. quality. Phil Wherry: If you've still got the earlier URL, just tack "&quality=90" onto the end of it. Phil Wherry: http://www.wsanford.com/webcam/earthdial/resizer.ph p?filename=fcps-earthdial.jpg&scale=2&quality=90 drofnasw: Just curious -- is the output quality of the new utility identical to photoweb? Phil Wherry: Yes; it uses the same tools that photoweb does internally. The pictures should be bit-for-bit identical given the same settings, in fact. drofnasw: Using the tag in combo. w. your utility, how should I spec the IMG WIDTH and HEIGHT -- the actual size of the image before or after resizing? Phil Wherry: Use the "after resizing" size. drofnasw: Hmmm. The image you see of the Webcam is actually 640x480; I'm using HTML to force the browser to resize it to 320x240. I'm concerned that the HTML will over-ride your utility. Phil Wherry: No, the browser will display it at whatever resolution is specified. If the underlying image is the same size, no scaling will occur. If you're in doubt, just leave out the HEIGHT and WIDTH tags; the image is quite small so it won't cause a big performance hit. http://www.wsanford.com/webcam/earthdial/extras/resi zer.php?filename=eggcam_test_still-img.jpg&scale=2& quality=90 Phil Wherry: Good deal. Note that scale=2 and quality=90 are both defaults so you can omit them if you'd like. drofnasw: Looks good at a scale factor of 4 too! Phil Wherry: Even 8 looks good to me. Phil Wherry: (though it's probably too small for your needs for this project) drofnasw: When one FTPs files, why doesn't the app prompt you re: overwriting files? Phil Wherry: it's not directly supported by the FTP protocol. drofnasw: So if we just overwrite the same files every 10 min., then the Web page(s) will grab the most current images and resize 'em accordingly, right? Phil Wherry: That's correct. drofnasw: Piece of cake! Phil Wherry: Yep, should be simple. ================================================================= Walter Sanford, Director Carl Sandburg Middle School Center for Sky Awareness 8428 Fort Hunt Road Sandburg Planetarium Alexandria, VA 22308 Fairfax County Public Schools Work: 703-799-6169 -6197 (fax) E-mail: wsanford@wsanford.com Home: 703-765-9392 AMS Project ATMOSPHERE Atmospheric Education Resource Agent SCSA, Geosystems, & Camp T-Equity - URL: http://www.wsanford.com/ =================================================================