Organize display photos EXIF information _php

Source: Internet
Author: User
Keywords Information photos display sorting exif exif
Display photo EXIF information in Chinese mode, showing the outline of the picture

This thing in addition to some PHP forum simple display 32 information, other people's lb5000 forum to see the show, the ASP also has a long time without contact to look dizzy.

Do not want to repeat work, search Google, in addition to ASP did not find other open-source display exif, so sorting out may be useful.

There is no technical content, basically just Chinese and data collation work, the following code for the main part, all files in the compression package, can be widely used in photo albums and forums to display picture information plug-in, hoping to become familiar with the relevant knowledge of friends to find bugs or to optimize.

There should be a lot of information, if used alone should be enough.

——————————————————
I've seen pictures of people coming in, thumbnails, Photoshop, but I don't know how to put them in, anybody know?

Thumbnails can display:)


PHP Code:--------------------------------------------------------------------------------

/**
* function to get image information
*
* A function to obtain the image information comprehensively
*
* @access Public
* @param string $img picture 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 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", "rig HT 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 test",
"4" = "Partition",
"5" = "Evaluation",
"6" = "local",
"255" = "Other"
);
$Lightsource _arr = Array (
"0" = "Unknown",
"1" = "Daylight",
"2" = "fluorescent",
"3" = "tungsten filament",
"Ten" = "flash",
"+" = "standard Light a",
"+" = "Standard light B",
"+" = "standard light C",
"A" and "D55",
"+" = "D65",
"A" and "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 Picture 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" = "-----------------------------",
"Picture description" and "$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],
"Modified Time" = $exif [Ifd0][datetime],
"Author" = $exif [Ifd0][artist],
"YCbCr position Control" = $YCbCrPositioning [$exif [ifd0][ycbcrpositioning]],
"Copyright" = $exif [Ifd0][copyright],
"Photography Copyright" = $exif [Computed][copyright.photographer],
"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],
"Digital Time" = $exif [exif][datetimedigitized],
"Shooting resolution High" = $exif [Computed][height],
"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" = "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),
"Flash" = Getimageinfoval ($exif [Exif][flash], $Flash _arr),
"Exposure Mode" = ($exif [exif][exposuremode]==1?] Manual ":" Auto "),
"White balance" = ($exif [exif][whitebalance]==1?] Manual ":" Auto "),
"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][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 ': JIS
' 0x55,0x4e,0x49,0x43,0x4f,0x44,0x45,0x00 ': Unicode
' 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 ': Undefined
*/
"User Comment Code" = $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 "),
"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>





  • 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.