USE AT OWN RISK
Generated: Tue Jul 31 15:22:05 2007 from imginfo.php 2005/12/11 1.9 KB bytes.
<html> <head> <title>Image Information</title> </head> <body> <?php // AIM: Just to show image INFORMATION // $in_file = 'temp3/const-001.jpg'; $in_file = 'temp3/const-025.jpg'; $meol = "\r\n"; if ( ! is_file($in_file) ) { echo "ERROR: Unable to loacte file $in_file... $meol"; exit(1); } file_information ( $in_file ); echo "Done ...<br>$meol"; exit(0); function file_information ( $in_file ) { global $meol; $file_size = filesize( $in_file ); $file_time = filemtime( $in_file ); $src_img = imagecreatefromjpeg("$in_file"); // $src_img = LoadJpeg("$in_file"); // forces an IMAGE to be created if no load if ( !$src_img ) { echo "ERROR: FAILED to load JPEG image ... aborting ...<br>$meol"; exit(3); } // get it's height and width $imgSx = imagesx($src_img); $imgSy = imagesy($src_img); if( ($imgSx == 0) || ($imgSy == 0) ) { echo "ERROR: FAILED to get image size! ... aborting ...<br>$meol"; exit(4); } echo "Loaded '$in_file', of size $imgSx X $imgSy ...$file_size bytes<br>$meol"; // see if there is ALREADY a thumbnail image embedded ... $thumb_data = exif_thumbnail($in_file, $in_width, $in_height, $in_type); if ( $thumb_data ) { // PROCESS THUMB DATA // got THUMB echo "Got thumbnail image $in_width X $in_height ($in_type) ...<br>$meol"; } else { echo "Does NOT contain a thumbnail image ...<br>$meol"; } } function LoadJpeg($imgname) { $im = @imagecreatefromjpeg($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ $im = imagecreatetruecolor(150, 30); /* Create a black image */ $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an errmsg */ imagestring($im, 1, 5, 5, "Error loading $imgname", $tc); } return $im; } ?> </body> </html>