php 判断两个图片一样,php中几个简单图片判断函数_PHP教程

int exif_imagetype ( string $filename )

1 imagetype_gif

2 imagetype_jpeg

3 imagetype_png

4 imagetype_swf

5 imagetype_ps教程d

6 imagetype_bmp

7 imagetype_tiff_ii (intel byte order)

8 imagetype_tiff_mm (motorola byte order)

9 imagetype_jpc

10 imagetype_jp2

11 imagetype_jpx

12 imagetype_jb2

13 imagetype_swc

14 imagetype_iff

15 imagetype_wbmp

16 imagetype_xbm

*/

$img="image.gif"; //定义文件

if(exif_imagetype($img)!=imagetype_gif) //判断文件类型

{

echo "指定的图片不是gif图片"; //输出结果

}

else

{

echo "指定的图片是gif图片";

}

/*

array exif_read_data ( string $filename [, string $sections = null [, bool $arrays = false [, bool $thumbnail = false ]]] )

*/

echo "test1.jpg:

n"; //输出文件名

$exif=exif_read_data('tests/test1.jpg','ifd0'); //读取文件1信息

//根据结果判断

echo $exif===false ? "no header data found.

n":"image contains headers

n";

$exif=exif_read_data('tests/test2.jpg',0,true); //读取文件2信息

echo "test2.jpg:

n"; //输出文件名

foreach($exif as $key=>$section) //循环读取信息

{

foreach($section as $name=>$val)

{

echo "$key.$name:$val

n";

}

}

/*

test1.jpg:

no header data found.

test2.jpg:

file.filename: test2.jpg

file.filedatetime: 1017666176

file.filesize: 1240

file.filetype: 2

file.sectionsfound: any_tag, ifd0, thumbnail, comment

computed.html: width="1" height="1"

computed.height: 1

computed.width: 1

computed.iscolor: 1

computed.byteordermotorola: 1

computed.usercomment: exif test image.

computed.usercommentencoding: ascii

computed.copyright: photo (c) m.boerger, edited by m.boerger.

computed.copyright.photographer: photo (c) m.boerger

computed.copyright.editor: edited by m.boerger.

ifd0.copyright: photo (c) m.boerger

ifd0.usercomment: ascii

thumbnail.jpeginterchangeformat: 134

thumbnail.jpeginterchangeformatlength: 523

comment.0: comment #1.

comment.1: comment #2.

comment.2: comment #3end

thumbnail.jpeginterchangeformat: 134

thumbnail.thumbnail.height: 1

thumbnail.thumbnail.height: 1

//*/

$index="1"; //定义索引

$string=exif_tagname($index); //获得图像索引的头信息

echo $string; //输出结果

//

if(array_key_exists('file',$_request))

{

$image=exif_thumbnail($_request['file'],$width,$height,$type); //取得文件的缩略图

}

else //如果数组不存在相应的键值

{

$image=false; //返回错误

}

if($image!==false) //如果返回true

{

header("content-type:".image_type_to_mime_type($type)); //发送头文件

echo $image; //输出缩略图

exit; //结束php教程代码

}

else //如果返回错误

{

echo "no thumbnail available"; //输出信息

}

http://www.bkjia.com/PHPjc/632997.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632997.htmlTechArticleint exif_imagetype ( string $filename ) 1 imagetype_gif 2 imagetype_jpeg 3 imagetype_png 4 imagetype_swf 5 imagetype_ps教程d 6 imagetype_bmp 7 imagetype_tiff_ii (intel byte order...

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值