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生成静态HTML文档实现代码

利用PHP,将数据库中的文章数据生成单个的HTML文档。首先,有利于搜索引擎的收录。其次,避免数据库中的字段暴露在地址栏上,更安全。 给出代码: <?php //引...

preg_match_all使用心得分享

preg_match_all — 进行全局正则表达式匹配 说明 复制代码 代码如下:int preg_match_all ( string pattern, string subject...

PHP自定义函数实现assign()数组分配到模板及extract()变量分配到模板功能示例

本文实例讲述了PHP自定义函数实现assign()数组分配到模板及extract()变量分配到模板功能。分享给大家供大家参考,具体如下: 这里模拟tp框架模板变量分配与赋值操作。 ext...

Laravel 5.3 学习笔记之 配置

1、简介 Laravel 的所有配置文件都存放在 config 目录下,每个配置项都有注释,以保证浏览任意配置文件的配置项都能直观了解该配置项的作用及用法。 2、访问配置值 你可以使...

PHP的JSON封装、转变及输出操作示例

本文实例讲述了PHP的JSON封装、转变及输出操作。分享给大家供大家参考,具体如下: Json封装 protected function renderJSON($data=[], $...