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序列号生成函数和字符串替换函数代码

复制代码 代码如下: /** * 序列号生成器 */ function snMaker($pre = '') { $date = date('Ymd'); $rand = rand(10...

php 函数使用可变数量的参数方法

php在用户自定义函数中支持可变数量的参数列表。 在php5.5及更早的版本中,使用func_num_args(), func_get_arg(), func_get_args()函数实...

搭建Vim为自定义的PHP开发工具的一些技巧

搭建Vim为自定义的PHP开发工具的一些技巧

虽然 vim 本质上只是一个编辑器。但只要配合一些适当的插件, vim 也能变成一个全功能的 IDE 。笔者使用 vim 已经有挺长一段时间了,经过反复的试验,配置了一个高效的 PHP...

PHP编程实现脚本异步执行的方法

本文实例讲述了PHP编程实现脚本异步执行的方法。分享给大家供大家参考,具体如下: php语言得用fsockopen()函数,实现脚本异步运行,代码如下 异步请求函数(用debug参数若为...

关于访问控制的一首PHP面试题(对属性或方法的访问控制)

复制代码 代码如下: class Foo { private $name = 'hdj'; public function getName(){ return $this->nam...