PHP获取Exif缩略图的方法

yipeiwu_com6年前PHP代码库

本文实例讲述了PHP获取Exif缩略图的方法。分享给大家供大家参考。具体实现方法如下:

// file to read
$file = 'test.jpg';
$image = exif_thumbnail($file, $width, $height, $type);
// width, height and type get filled with data
// after calling "exif_thumbnail"
if ($image) {
  // send header and image data to the browser:
  header('Content-type: ' .image_type_to_mime_type($type));
  print $image;
}
else {
  // there is no thumbnail available, handle the error:
  print 'No thumbnail available';
}

希望本文所述对大家的php程序设计有所帮助。

相关文章

php实现插入排序

<?php /** * 插入排序 * @param Array $a 无序集合 * @return Array 有序集合 */ function insertS...

JoshChen_php新手进阶高手不可或缺的规范介绍

PHP规范1. 为什么要编码规范•编码规范(code conventions)对于程序员而言尤为重要,有以下几个原因:1.在一个软件的生命周期中,80%的花费用于维护。 2....

PHP 5.0对象模型深度探索之对象复制

默认地,用__clone方法将建立一个与原对象拥有相同属性和方法的对象. 如果你想在克隆时改变默认的内容,你要在__clone中覆写(属性或方法)。   克隆的方法可以没有参数...

php5.2 Json不能正确处理中文、GB编码的解决方法

php5.2新增的json功能是非常受欢迎的,但是经过测试发现, json_encode对中文的处理是有问题的, 1.不能处理GB编码,所有的GB编码都会替换成空字符. 2.utf8编码...

php调用c接口无错版介绍

php调用c接口无错版介绍

1.首先是要安装好PHP2.进入PHP的下载解压目录下的ext目录#cd /root/php-5.3.6/ext#./ext_skel --extname=hmc说明:./ext_ske...