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二维数组去重算法

需求 现在有下面一组二维数组: array(8) { [0]=> array(2) { ["name"]=> string(4) "name" ["va...

php学习笔记之字符串常见操作总结

本文实例讲述了php字符串常见操作。分享给大家供大家参考,具体如下: 字符串的定义 可以用单引号或双引号来定义字符串 <?php $str = "hello"; $st...

php基于双向循环队列实现历史记录的前进后退等功能

本文实例讲述了php基于双向循环队列实现历史记录的前进后退等功能。分享给大家供大家参考。具体如下: 为实现一个记录操作历史的功能 1. 和撤销,反撤销功能类似的一个功能。(实现操作的前进...

PHP fopen()和 file_get_contents()应用与差异介绍

复制代码 代码如下: $file=fopen("11.txt","r")or exit("Unable to open file!");//fopen打开文件,如果不存在就显示打不开。...

深入PHP5中的魔术方法详解

从PHP 5以后的版本,PHP中的类就可以使用魔术方法了。其规定以两个下划线(__)开头的方法都保留为魔术方法,所以建议大家函数名最好不用__开头,除非是为了重载已有的魔术方法。 1、_...