PHP allows you to display the exif information of a photo ,. PHP can display the exif information of a photo. PHP programming can display the EXIF information of a photo and display the thumbnail effect in the image. the code is as follows: * ** function for retrieving image information * a full PHP method for displaying photo exif information,
PHP programming allows you to display the EXIF information of a photo and display the thumbnail effect in the image. the code is as follows:
<? /*** Function for obtaining image information * a function for fully obtaining image information * @ access public * @ param string $ img Image path * @ return array */function GetImageInfoVal ($ ImageInfo, $ 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 orde R) "," 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 ("", "", "inches", "centimeters "); $ YCbCrPositioning = array ("", "the center of pixel array", "the datum point"); $ ExposureProgram = array ("undefined", "Manual "," Standard Program "," aperture prerequisite "," Shutter prerequisite "," Depth of field prerequisite "," motion mode "," Portrait Mode "," Landscape mode "); $ MeteringMode_arr = array ("0" => "unknown", "1" => "average", "2" => "central key average light measurement ", "3" => "test", "4" => "partition", "5" => "evaluation", "6" => "local ", "255" => "other"); $ Lightsource_arr = array ("0" => "unknown", "1" => "daylight ", "2" => "fluorescent lamps", "3" => "tungsten lamps", "10" => "Flashlight", "17" => "standard lamps ", "18" => "standard light B", "19" => "standard light C", "20" => "D55", "21" => "D65 ", "22" => "D75", "255" => "Other"); $ Flash_arr = array ("0" => "flash did not fire", "1" => "flash fired ", "5" => "flash fired 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 Image EXIF information");} else {$ exif = exif_read_data ($ img, 0, true ); $ new_img_info = array ("file information" => "-------------- --------------- "," FILE name "=> $ exif [FILE] [FileName]," FILE type "=> $ imgtype [$ exif [FILE] [FileType], "FILE Format" => $ exif [FILE] [MimeType], "FILE Size" => $ exif [FILE] [FileSize], "timestamp" => date ("Y-m-d H: I: s", $ exif [FILE] [FileDateTime]), "Image information" => "---------------------------", "Image description" => $ exif [IFD0] [ImageDescription], "manufacturer" => $ exif [IFD0] [Make], "Model" => $ exif [IFD0] [Model], "direction" => $ Orientation [$ exif [IFD0] [Orientation] ], "Horizontal resolution" => $ exif [IFD0] [XResolution]. $ ResolutionUnit [$ exif [IFD0] [ResolutionUnit], "vertical resolution" => $ exif [IFD0] [YResolution]. $ ResolutionUnit [$ exif [IFD0] [ResolutionUnit], "create Software" => $ exif [IFD0] [Software], "Modification time" => $ exif [IFD0] [DateTime], "author" => $ exif [IFD0] [Artist], "YCbCr location control" => $ YCbCrPositioning [$ exif [IFD0] [YCbCrPositioning], "Copyright" => $ exif [IFD0] [Copyright], "Photography Copyright" => $ exif [COMPUTED] [Copyright. photo Grapher], "edit Copyright" => $ exif [COMPUTED] [Copyright. editor], "shooting information" => "---------------------------", "Exif version" => $ exif [EXIF] [ExifVersion], "FlashPix version" => "Ver. ". number_format ($ exif [EXIF] [FlashPixVersion]/100,2), "shooting time" => $ exif [EXIF] [DateTimeOriginal], "Digitization time" => $ exif [EXIF] [DateTimeDigitized], "High shooting resolution" => $ exif [COMPUTED] [Height], "Shooting resolution Width" => $ exif [COMPUTED] [Width],/* The actual aperture value Lens when the image was 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 is '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" => "F ". $ exif [EXIF] [MaxApertureValue], "exposure time "=> $ Exif [EXIF] [ExposureTime]," F-Number "=> $ exif [EXIF] [FNumber], "metering mode" => GetImageInfoVal ($ exif [EXIF] [MeteringMode], $ MeteringMode_arr), "light source" => GetImageInfoVal ($ exif [EXIF] [LightSource], $ Lightsource_arr), "Flashlight" => 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 = log (ISO speedrating/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] [ComponentsConfiguration]) = "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, 0x00 ': JIS '0x55, 0x4e, 0x49,0x43, 0x4f, 0x44,0x45, 0x00': Unicode '0x00, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00, 0x00': Undefined */"user annotation encoding" => $ exif [COMPUTED] [UserCommentEncoding], "User comments" => $ exif [COMPUTED] [UserComment], "Color Space" => ($ exif [EXIF] [ColorSpace] = 1? "SRGB": "Uncalibrated"), "Exif image width" => $ exif [EXIF] [ExifImageLength], "Exif image height" => $ exif [EXIF] [ExifImageWidth], "File Source" => (bin2hex ($ exif [EXIF] [FileSource]) = 0x03? "Digital still camera": "unknown"), "scenario 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. =" |
";?> Image information
SCRIPT
SCRIPT
Compile, PHP programming can display the EXIF information of a photo and display the thumbnail effect in the image. the code is as follows:/*** function for obtaining image information * a complete function...