There is a photograph named bar.jpg in a remote URL called http://www.foo.com The photograph is about 640 x 480 in size.
The following script allows me to open and read the file. In addition, I have a file named data.jpg in my web folder. I want to write the bar.jpg into the data.jpg file and at the same time reduce that image to 256 x 192. After testing the following script on Apache server / MS Win 98 and PHP with php_gd libraries it seems that I can accomplish that. However, I cannot add a line of copy below the photo like: <? print ("It is "); print (date("l F j, Y")); ?> Only the photo shows up and not the text. How can I add a line of text along with the photo? Thank you. The script follows... Tony Ritter ......................................... <? $fh = fopen('http://www.foo.com/bar.jpg', 'r'); if ($fh) { $imgbuffer = null; while ($chunk = fread($fh, 1000000)) $imgbuffer .= $chunk; fclose($fh); } // o.k. to here... $filename="C:\apache\htdocs\data.jpg"; $thephoto=$imgbuffer; $myfile=fopen($filename,"w+")or die("Could not open the file."); fwrite($myfile,$thephoto)or die ("Could not write to the file"); fclose($myfile); ?> <? $new_w=256; $new_h=192; header("Content-type: image/jpeg"); header("Content-type: text/html"); $dst_img=ImageCreate($new_w,$new_h); $src_img=ImageCreateFromJpeg("data.jpg"); ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),I mageSY($src_img)); ImageJpeg($dst_img); ?> <? print ("It is "); // This line is not outputting to the browser. print (date("l F j, Y")); // ...and neither is this one. ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php