PHP implements the method of displaying EXIF information of photos,
PHP programming can be implemented to display photos EXIF information, display image thumbnail effect, the code is as follows:
<?/*** function to obtain image information * A function to obtain image information comprehensively * @access public* @param string $img picture path * @return array*/function getimageinfoval ($Ima Geinfo, $val _arr) {$InfoVal = "unknown"; foreach ($val _arr as $name = + $val) {if ($name = = $ImageInfo) {$InfoVal = & $val; Break }} return $InfoVal;} function Getimageinfo ($img) {$imgtype = Array ("", "GIF", "JPG", "PNG", "SWF", "PSD", "BMP", "TIFF" (Intel byte Order ) "," TIFF (Motorola byte order), "JPC", "JP2", "JPX", "JB2", "SWC", "IFF", "WBMP", "XBM"); $Orientation = Array ("", "top left Side", "top right side", "bottom right side", "bottom left side", "left side top", ' Right side top ', ' right side bottom ', ' left side bottom '; $ResolutionUnit = Array ("", "" "," "", "" cm "); $YCbCrPositioning = Array ("", "the center of Pixel Array", "The Datum point"); $ExposureProgram = Array ("Undefined", "manual", "Standard program", "Aperture precedent", "shutter precedent", "depth of field", "Sport Mode", "Portrait Mode", "landscape mode"); $MeteringMode _arr = Array ("0" = "Unknown", "1" = "average", "2 "=" Central weighted average metering "," 3 "+" point Measurement "," 4 "=" Partition "," 5 "=" Evaluation "," 6 "=" local "," 2 "=" and "others"); $Lightsource _arr = Array ("0" = "Unknown", "1" = "Daylight", "2" = "Fluorescent", "3" = "tungsten", "Ten" and "Flash", "+" and "standard Light a", "all" and "standard light B", "+" and "Standard light C", "a" and "D55", "+" = "D65", "All" and "D75", "255" and "others"; $Flash _arr = Array ("0" = "flash did not Fire", "1" = "Flash Fired", "5" = "Flash f" Ired but strobe return light not Detected "," 7 "=" Flash fired and strobe return light detected ",); $exif = Exif_read_data ($img, "IFD0"); if ($exif ===false) {$new _img_info = array ("File Information" = "No Picture exif information"); } else {$exif = Exif_read_data ($img, 0,true); $new _img_info = Array ("File Information" = "-----------------------------", "filename" = = $exif [File][filenaMe], "file type" = = $imgtype [$exif [File][filetype]], "file format" = $exif [File][mimetype], File size =& Gt $exif [file][filesize], "timestamp" = Date ("y-m-d h:i:s", $exif [File][filedatetime]), "image information" = "-------- ---------------------"," Picture description "and" Ifd0][make "[Ifd0][imagedescription]," Manufacturer "and" $exif ", "Model" = $exif [Ifd0][model], "direction" = = $Orientation [$exif [ifd0][orientation]], "horizontal Resolution" = = $e Xif[ifd0][xresolution]. $ResolutionUnit [$exif [Ifd0][resolutionunit]], "vertical resolution" and "= $exif [ifd0][yresolution].$ resolutionunit[$exif [Ifd0][resolutionunit]], "create software" = $exif [Ifd0][software], "Modified Time" and "$exif" [IFD0 ][datetime], "author" = $exif [Ifd0][artist], "YCbCr position control" and "$YCbCrPositioning [$exif [Ifd0][ycbcrpositi Oning]], "copyright" = $exif [Ifd0][copyright], "photography copyright" = "$exif [Computed][copyright.photographer], "Edit Copyright" = $exif [COmputed][copyright.editor], "shooting information" = "-----------------------------", "Exif version" and "$exif [Exif][exi Fversion], "FlashPix version" = "Ver.". Number_format ($exif [exif][flashpixversion]/100,2), "Shooting Time" and "the duration of the recording" $exi F[exif][datetimeoriginal], "digital time" = $exif [exif][datetimedigitized], "shooting resolution High" = $exif [Computed][heig HT], "shooting resolution width" = $exif [Computed][width],/* The actual aperture value of lens when the image is taken . Unit is APEX. To convert this value to ordinary f-number (f-stop), calculate this value ' s power of Root 2 (=1.4142). For example, if the Aperturevalue are ' 5 ', f-number is pow (1.41425,5) = F5.6. */"aperture" = $exif [Exif][aperturevalue], "shutter speed" = $exif [Exif][shutterspeedvalue], "Shutter aperture" = = $exif [Computed][aperturefnumber], "Maximum aperture value" and "F". $exif [Exif][maxaperturevalue], "exposure time" = $ex If[exif][exposuretime], "f-number" = $exif [Exif][fnumber], "metering mode" = Getimageinfoval ($exif [Exif][meteringmode], $MeteringMode _arr), "light source" = Getimageinfoval ($exif [Exif][lightsource], $Lightsource _arr), "flash" = Getimageinfoval ($exif [Exif][flas h], $Flash _arr), "exposure mode" = ($exif [exif][exposuremode]==1? Manual ":" Auto ")," white balance "= ($exif [exif][whitebalance]==1?] Manual ":" Automatic ")," exposure Program "= $ExposureProgram [$exif [Exif][exposureprogram]],/* Brightness of taken subject, Unit is APEX. To calculate Exposure (Ev) from Brigtnessvalue (BV), you must add Sensitivityvalue (SV). EV=BV+SV Sv=log ((isospeedrating/3.125), 2) iso100:sv=5, iso200:sv=6, iso400:sv=7, iso125:sv=5.32. */"exposure compensation" = $exif [Exif][exposurebiasvalue]. " EV "," iso sensitivity "= $exif [exif][isospeedratings], component configuration = (Bin2Hex ($exif [Exif][componentsconfigurat ION]) = = "01020300"? " YCbCr ":" RGB "),//' 0x04,0x05,0x06,0x00 ' =" RGB "' 0x01,0x02,0x03,0x00 ' =" YCbCr "" image compression rate "= = $exif [Exif][compressedbitsperpixel]. " Bits/pixel "," focus distance "= $exif [computed][focusdistance]." M "," focal length "= = $exif [Exif][focallength]." MM "," equivalent 35mm focal Length "= $exif [Exif][focallengthin35mmfilm]." MM ",/* Stores user comment. This tag allows to use Two-byte character code or Unicode. First 8 bytes describe the character code. ' JIS ' is a Japanese character code (known as Kanji). ' 0x41,0x53,0x43,0x49,0x49,0x00,0x00,0x00 ': ASCII ' 0x4a,0x49,0x53,0x00,0x00,0x00,0x00,0x00 ': JIS ' 0x55,0x4e,0x49,0x 43,0x4f,0x44,0x45,0x00 ': Unicode ' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ': Undefined */"user comment Code" = $ex If[computed][usercommentencoding], "user notes" = = $exif [computed][usercomment], "color space" = ($exif [exif][ Colorspace]==1? " SRGB ":" uncalibrated ")," exif image width "= $exif [Exif][exifimagelength]," exif image height "= $exif [exif][exifimage Width], "file source" = (Bin2Hex ($exif [Exif][filesource]) ==0x03?" Digital still Camera ":" Unknown ")," scene type "= (Bin2Hex ($exif [exif][scenetype]) ==0x01?" A directly photographed image ":" Unknown ")," thumbnail file format "= = $exif [Computed][thumbnail.filetype]," thumbnail MIME format "= > $exif [Computed][thumbnail.mimetype]); } return $new _img_info;} $innerhtml = ""; $exif = Getimageinfo ($_get[' img "); $innerhtml. ="
"; foreach ($exif as $name = = $val) {$innerhtml. ="
{$name} |
{$val} |
";} $innerhtml. = "
"; if ($_get[' img ']) {$image = Exif_thumbnail ($_get[' img");} else {$image = false;} if ($image!==false) {$innerhtml. = "";} else {//no thumbnail available, handle the error here $innerhtml. = "no thumbnail available";} $innerhtml. = " |
";? > <title>Picture information</title>
http://www.bkjia.com/PHPjc/840633.html www.bkjia.com true http://www.bkjia.com/PHPjc/840633.html techarticle PHP Implementation of display photos Exif information method, PHP programming can be implemented to display photos EXIF information, display image thumbnail effect, the code is as follows:/*** get image information function * A full ...