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记录和读取JSON格式日志文件

我们有时需要记录用户或者后端的某个操作事件的运行情况,可以使用后端语言如PHP将操作结果记录到日志文件中,方便测试和查找问题。尤其是这些在后端运行的而前端不能直接看到运行结果的,那么就可...

php编写批量生成不重复的卡号密码代码

闲的蛋疼的时候,顺便加强下自己对PHP中数组操纵的一些技巧,就写了下面的一段小代码,可以随机生成卡号密码对应的数组,并且自动去重复,思路没有,纯粹瞎掰。 <?php h...

php列出一个目录下的所有文件的代码

复制代码 代码如下: <?php function dir_path($path) { $path = str_replace('\\', '/', $path); if (sub...

PHP的CURL方法curl_setopt()函数案例介绍(抓取网页,POST数据)

通过curl_setopt()函数可以方便快捷的抓取网页(采集很方便大笑),curl_setopt 是PHP的一个扩展库      使用条件:需...

php简单定时执行任务的实现方法

本文实例讲述了php简单定时执行任务的实现方法。分享给大家供大家参考。具体实现方法如下: <?php ignore_user_abort(); set_time_lim...