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语言: 根据中文裁减字符串复制代码 代码如下:function cutstr($string,$length, $dot = ' ...') {  if (strlen(...

PHP实现阳历到农历转换的类实例

本文实例讲述了PHP实现阳历到农历转换的类。分享给大家供大家参考。具体如下: 复制代码 代码如下:<?php //PHP阳历到农历转换的一个类 class Calendar...

PHP实现算式验证码和汉字验证码实例

在PHP网站开发中,验证码可以有效地保护我们的表单不被恶意提交,但是如果不使用算式验证码或者汉字验证码,仅仅使用简单的字母或者数字验证码,这样的验证码方案真的安全吗? 大家知道简单数字或...

PHP实现二维数组根据key进行排序的方法

本文实例讲述了PHP实现二维数组根据key进行排序的方法。分享给大家供大家参考,具体如下: 在PHP中内置了很多对数组进行处理的函数,有很多时候我们直接使用其内置函数就能达到我们的需求,...

PHP中trim()函数简单使用指南

string trim ( string $str [, string $charlist ] ) - 去除字符串首尾处的空白字符(或者其他字符)   trim()函数当第二个参数为空时...