PHP implementation method for displaying EXIF information of photos _php tutorial

Source: Internet
Author: User

PHP implementation method for displaying EXIF information of photos


PHP programming can be implemented to display photos EXIF information, display image thumbnail effect, the code is as follows:

  $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" = "center-weighted average metering", "3" and "="  Point Test "," 4 "=" Partition "," 5 "=" Evaluation "," 6 "=" local "," 255 "and" other ");  $Lightsource _arr = Array ("0" = ="Unknown", "1" = "Daylight", "2" = "Fluorescent", "3" = "tungsten", "ten" and "Flash", "+" = "Standard Light a"    "," "+" and "Standard light B", "+" and "Standard light C", "a" and "D55", "Up" and "D65", "all" = "D75",  "255" = "other"); $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 "$exif [ifd0][imaged Escription], "Manufacturer" = $exif [Ifd0][make], "model" = = $exif [Ifd0][model], "direction" = + $Orie ntation[$exif [ifd0][orientation]], "horizontal Resolution" = = $exif [ifd0][xresolution]. $ResolutionUnit [$exif [ifd0][    Resolutionunit]], "vertical Resolution" = = $exif [ifd0][yresolution]. $ResolutionUnit [$exif [Ifd0][resolutionunit]], "Creating software"      = = $exif [Ifd0][software], "modification Time" = $exif [Ifd0][datetime], "author" and "$exif [Ifd0][artist],      "YCbCr position control" and "$YCbCrPositioning [$exif [ifd0][ycbcrpositioning]]," copyright "+ $exif [Ifd0][copyright],      "Photography Copyright"-$exif [Computed][copyright.photographer], "edit copyright"--$exif [Computed][copyright.editor], "Shooting information" and "-----------------------------", "Exif version" and "$exif [Exif][exifversion]," FlashPix version "=&  Gt "Ver.". Number_format ($exif [EXIF][flashpixversion]/100,2), "shooting time" = = $exif [exif][datetimeoriginal], "Digital Time" and "$exif [exif][datetimed Igitized], "shooting resolution High" = $exif [Computed][height], "shooting resolution wide" = = $exif [Computed][width],/* The A      ctual 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][flash], $Flash _arr), "exposure mode" = ($exif [exif][exposuremode]==1? "Manual": "Automatic"), "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 ratio "= $exif [exif][compressedbits Perpixel]. " 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. ="
   
   ";} $innerhtml. = " 
    
{$name} {$val}
"; 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/834953.html www.bkjia.com true http://www.bkjia.com/PHPjc/834953.html techarticle PHP Implementation of display photos EXIF information PHP programming can be implemented to display photos EXIF information, display image thumbnail effect, the code is as follows:?/*** get image Information function * A comprehensive ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.