function jpg_maker_info($thejpg) { // create lookup table: $lookup = Array(); // format: $lookup['unique identifier'] = array("are you sure", "what's it called", "what version") $lookup["01444"] = Array(0,"MS Paint",null); $lookup["ImageReady"] = Array(1,"ImageReady",null); $lookup["GIMP"] = Array(1,"The GIMP",null); $lookup["Ducky"] = Array(1,"Adobe Photoshop","beta"); // commonly illegally distributed $lookup["Photoshop 3.0"] = Array(1,"Adobe Photoshop","3.0"); $lookup["Photoshop¨ 4.0"] = Array(1,"Adobe Photoshop","4.0"); $lookup["Photoshop¨ 5.0"] = Array(1,"Adobe Photoshop","5.0"); $lookup["Photoshop¨ 5.2"] = Array(1,"Adobe Photoshop","5.2"); $lookup["Photoshop 7.0"] = Array(1,"Adobe Photoshop","7.0"); $lookup["Photoshop"] = Array(1,"Adobe Photoshop",null); $lookup["VT-Compress"] = Array(1,"VT-Compress (Xing)",null); $lookup["PictureGear"] = Array(1,"Sony PictureGear",null); $lookup["OLYMPUS DIGITAL CAMERA"] = Array(1,"Olympus Digital Camera",null); // exif data will give more info $lookup["PowerShot"] = Array(0,"Canon Digital Camera",null); $lookup["gd-jpeg v1.0"] = Array(1,"GD-Lib","1.0"); $lookup["gd-jpeg v2.0"] = Array(1,"GD-Lib","2.0"); $lookup["gd-jpeg"] = Array(1,"GD-Lib",null); $lookup["XV Version"] = Array(1,"XV",null); $lookup["DC210"] = Array(0,"Kodak Digital Camera",null); $lookup["AppleMark"] = Array(1,"AppleMark",null); $lookup[" "] = Array(0,"Ulead Photo Editor",null); // will very likely match other products too // read first 250 bytes of file if(!$handle = @fopen($thejpg, "r")) { return false; } $data = @fgets($handle, 250); @fclose ($handle); // check is JPG if(!stristr($data,"JFIF")) { // not JPG return false; } // get 'comment' header for($i=24 ; ord($char)!=255, $i<250 ; $i++) { $char = $data{$i}; if(ord($char)!=255) { $header .= $char; } } // un-comment if you're looking to add to the lookup table //echo "[".$header."]"; // look for product info foreach($lookup as $part=>$product) { if(stristr($header,$part)) { $is_definate_match = ($product[0]==1); $product_name = $product[1]; $product_version = $product[2]; break; } } if(!empty($product_name)) { return Array($is_definate_match,$product_name,$product_version,$header); } else { return Array(1,"unknown program, or is not JPG","",$header); } } ?>
".htmlspecialchars($header)."