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实现的观察者模式。分享给大家供大家参考,具体如下: <?php //定义观察者调用接口 class transfer{ prote...

对php 判断http还是https,以及获得当前url的方法详解

如下所示: $http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SER...

PHP闭包函数详解

匿名函数也叫闭包函数(closures允许创建一个没有指定没成的函数,最经常用作回调函数参数的值。 闭包函数没有函数名称,直接在function()传入变量即可 使用时将定义的变量当作函...

PHP使用zlib扩展实现GZIP压缩输出的方法详解

本文实例讲述了PHP使用zlib扩展实现GZIP压缩输出的方法。分享给大家供大家参考,具体如下: 一般情况下我们出现大量数据传输理希望减少服务器的带宽压力,会采取一种方式来压缩文件传输,...

PHP三元运算符的结合性介绍

先看一个三元运算式子: 复制代码 代码如下: <?php $a=1;$b=2;$c=3;$d=4; echo $a<$b?'xx':$a<$c?'yy':$a<$...