} $action = $_POST[ action ]; //**INSERT (Web server iis) THE FOLLOWING LINES:
} $action = $_POST[ action ]; //**INSERT THE FOLLOWING LINES: if (isset($_POST[ text ])) { $text = $_POST[ text ]; } else { $text = ; } //**END OF INSERT //get info on the pic we want $getpic = mysql_query( SELECT * FROM images WHERE image_id = $id ) or die(mysql_error()); $rows = mysql_fetch_array($getpic); extract($rows); $image_filename = images/ . $image_id . .jpg ; list($width, $height, $type, $attr) = getimagesize($image_filename); $image = imagecreatefromjpeg( $image_filename ); if ($bw == on ) { imagefilter($image, IMG_FILTER_GRAYSCALE); } //**INSERT THE FOLLOWING LINES: if ($text == on ) { imagettftext($image, 12, 0, 20, 20, 0, arial.ttf , $image_caption); } //**END OF INSERT if ($action == preview ) { header( Content-type:image/jpeg ); imagejpeg($image); } if ($action == save ) { imagejpeg($image, $image_filename); $url = location:showimage.php?id= . $id . &mode=change ; header($url); } ?> 3. Now go back to http://localhost/showimage.php?id=1 and try previewing your image with the embed caption feature checked. You should see something similar to Figure 7-6. You can see how easy it is to automatically add copyright notices or any text at all to your images. Let s break it down. 216 Chapter 7
Check Tomcat Web Hosting services for best quality webspace to host your web application.