PHP编程可实现显示照片EXIF信息,显示图片中缩略图效果,其代码如下:
<? /** * 获取图象信息的函数 * 一个全面获取图象信息的函数 * @access public * @param string $img 图片路径 * @return array */ function GetImageInfoVal($ImageInfo,$val_arr) { $InfoVal = "未知"; 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("", "", "英寸", "厘米"); $YCbCrPositioning = array("", "the center of pixel array", "the datum point"); $ExposureProgram = array("未定义", "手动", "标准程序", "光圈先决", "快门先决", "景深先决", "运动模式", "肖像模式", "风景模式"); $MeteringMode_arr = array( "0" => "未知", "1" => "平均", "2" => "中央重点平均测光", "3" => "点测", "4" => "分区", "5" => "评估", "6" => "局部", "255" => "其他" ); $Lightsource_arr = array( "0" => "未知", "1" => "日光", "2" => "荧光灯", "3" => "钨丝灯", "10" => "闪光灯", "17" => "标准灯光A", "18" => "标准灯光B", "19" => "标准灯光C", "20" => "D55", "21" => "D65", "22" => "D75", "255" => "其他" ); $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 ("文件信息" => "没有图片EXIF信息"); } else { $exif = exif_read_data ($img,0,true); $new_img_info = array ( "文件信息" => "-----------------------------", "文件名" => $exif[FILE][FileName], "文件类型" => $imgtype[$exif[FILE][FileType]], "文件格式" => $exif[FILE][MimeType], "文件大小" => $exif[FILE][FileSize], "时间戳" => date("Y-m-d H:i:s",$exif[FILE][FileDateTime]), "图像信息" => "-----------------------------", "图片说明" => $exif[IFD0][ImageDescription], "制造商" => $exif[IFD0][Make], "型号" => $exif[IFD0][Model], "方向" => $Orientation[$exif[IFD0][Orientation]], "水平分辨率" => $exif[IFD0][XResolution].$ResolutionUnit[$exif[IFD0][ResolutionUnit]], "垂直分辨率" => $exif[IFD0][YResolution].$ResolutionUnit[$exif[IFD0][ResolutionUnit]], "创建软件" => $exif[IFD0][Software], "修改时间" => $exif[IFD0][DateTime], "作者" => $exif[IFD0][Artist], "YCbCr位置控制" => $YCbCrPositioning[$exif[IFD0][YCbCrPositioning]], "版权" => $exif[IFD0][Copyright], "摄影版权" => $exif[COMPUTED][Copyright.Photographer], "编辑版权" => $exif[COMPUTED][Copyright.Editor], "拍摄信息" => "-----------------------------", "Exif版本" => $exif[EXIF][ExifVersion], "FlashPix版本" => "Ver. ".number_format($exif[EXIF][FlashPixVersion]/100,2), "拍摄时间" => $exif[EXIF][DateTimeOriginal], "数字化时间" => $exif[EXIF][DateTimeDigitized], "拍摄分辨率高" => $exif[COMPUTED][Height], "拍摄分辨率宽" => $exif[COMPUTED][Width], /* The actual aperture value of 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. */ "光圈" => $exif[EXIF][ApertureValue], "快门速度" => $exif[EXIF][ShutterSpeedValue], "快门光圈" => $exif[COMPUTED][ApertureFNumber], "最大光圈值" => "F".$exif[EXIF][MaxApertureValue], "曝光时间" => $exif[EXIF][ExposureTime], "F-Number" => $exif[EXIF][FNumber], "测光模式" => GetImageInfoVal($exif[EXIF][MeteringMode],$MeteringMode_arr), "光源" => GetImageInfoVal($exif[EXIF][LightSource], $Lightsource_arr), "闪光灯" => GetImageInfoVal($exif[EXIF][Flash], $Flash_arr), "曝光模式" => ($exif[EXIF][ExposureMode]==1?"手动":"自动"), "白平衡" => ($exif[EXIF][WhiteBalance]==1?"手动":"自动"), "曝光程序" => $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. */ "曝光补偿" => $exif[EXIF][ExposureBiasValue]."EV", "ISO感光度" => $exif[EXIF][ISOSpeedRatings], "分量配置" => (bin2hex($exif[EXIF][ComponentsConfiguration])=="01020300"?"YCbCr":"RGB"),//'0x04,0x05,0x06,0x00'="RGB" '0x01,0x02,0x03,0x00'="YCbCr" "图像压缩率" => $exif[EXIF][CompressedBitsPerPixel]."Bits/Pixel", "对焦距离" => $exif[COMPUTED][FocusDistance]."m", "焦距" => $exif[EXIF][FocalLength]."mm", "等价35mm焦距" => $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 */ "用户注释编码" => $exif[COMPUTED][UserCommentEncoding], "用户注释" => $exif[COMPUTED][UserComment], "色彩空间" => ($exif[EXIF][ColorSpace]==1?"sRGB":"Uncalibrated"), "Exif图像宽度" => $exif[EXIF][ExifImageLength], "Exif图像高度" => $exif[EXIF][ExifImageWidth], "文件来源" => (bin2hex($exif[EXIF][FileSource])==0x03?"digital still camera":"unknown"), "场景类型" => (bin2hex($exif[EXIF][SceneType])==0x01?"A directly photographed image":"unknown"), "缩略图文件格式" => $exif[COMPUTED][Thumbnail.FileType], "缩略图Mime格式" => $exif[COMPUTED][Thumbnail.MimeType] ); } return $new_img_info; } $innerhtml = ""; $exif = GetImageInfo($_GET['img']); $innerhtml .= "<TABLE>"; foreach($exif as $name=>$val) { $innerhtml .= "<TR><TD>{$name}</TD><TD>{$val}</TD></TR>"; } $innerhtml .= "<TR><TD colspan=\"2\">"; if ($_GET['img']) { $image = exif_thumbnail($_GET['img']); } else { $image = false; } if ($image!==false) { $innerhtml .= "<img src=\"thumbnail.php?img=".$_GET['img']."\" alt="PHP实现显示照片exif信息的方法_php技巧" >"; } else { // no thumbnail available, handle the error here $innerhtml .= "No thumbnail available"; } $innerhtml .= "</TD></TR></TABLE>"; ?> <html> <head> <title>图片信息</title> <meta http-equiv="Content-Type" content="text/html; charset=??????"> </head> <body> <SCRIPT> <!-- //初始化内容值 parent.followTd<?=$_GET['r_id'];?>.innerHTML='<?=$innerhtml;?>'; //已读取 parent.document.images.followImg<?=$_GET['r_id'];?>.loaded='yes'; --> </SCRIPT> </body> </html>

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

DVWA
DVWA(Damn Vulnerable Web App)는 매우 취약한 PHP/MySQL 웹 애플리케이션입니다. 주요 목표는 보안 전문가가 법적 환경에서 자신의 기술과 도구를 테스트하고, 웹 개발자가 웹 응용 프로그램 보안 프로세스를 더 잘 이해할 수 있도록 돕고, 교사/학생이 교실 환경 웹 응용 프로그램에서 가르치고 배울 수 있도록 돕는 것입니다. 보안. DVWA의 목표는 다양한 난이도의 간단하고 간단한 인터페이스를 통해 가장 일반적인 웹 취약점 중 일부를 연습하는 것입니다. 이 소프트웨어는

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

Dreamweaver Mac版
시각적 웹 개발 도구

PhpStorm 맥 버전
최신(2018.2.1) 전문 PHP 통합 개발 도구

SecList
SecLists는 최고의 보안 테스터의 동반자입니다. 보안 평가 시 자주 사용되는 다양한 유형의 목록을 한 곳에 모아 놓은 것입니다. SecLists는 보안 테스터에게 필요할 수 있는 모든 목록을 편리하게 제공하여 보안 테스트를 더욱 효율적이고 생산적으로 만드는 데 도움이 됩니다. 목록 유형에는 사용자 이름, 비밀번호, URL, 퍼징 페이로드, 민감한 데이터 패턴, 웹 셸 등이 포함됩니다. 테스터는 이 저장소를 새로운 테스트 시스템으로 간단히 가져올 수 있으며 필요한 모든 유형의 목록에 액세스할 수 있습니다.
