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设计模式 State (状态模式)

状态state模式是GOF23种模式中的一种,和命令模式一样,也是一种行为模式。状态模式和命令模式相当像,一样是“接口—实现类”这种模式的应用,是面向接口编程原则的体现。 状态模式属于对...

PHP引用返回用法示例

本文实例讲述了PHP引用返回的用法。分享给大家供大家参考,具体如下: 示例1: <?php $a = 1; function b(&$c) {   $c++;   re...

朋友网关于QQ相关的PHP代码(研究QQ的绝佳资料)

复制代码 代码如下: <? /*************************************** *******************************...

php清除和销毁session的方法分析

本文实例分析了php清除和销毁session的方法。分享给大家供大家参考。具体分析如下: 下面的代码分别用户删除单个session值和全部session unset() 用于释放一个已经...

php中json_encode UTF-8中文乱码的更好解决方法

最近在接口代码当中用到过json_encode,在网上找到说json_encode编码设置为UTF-8中文就不会乱码,经验证这办法确实是有效果的,但是不知道为什么,代码在用过一段时间之后...