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正则匹配中英文、数字及下划线的方法。分享给大家供大家参考,具体如下: 一、问题: 对于用户注册时的用户名要求由中英文、数字或下划线组成,不得含有其他字符。 二、解决方...

Ajax+PHP边学边练 之五 图片处理

Ajax+PHP边学边练 之五 图片处理

先上个效果图:  Sample6_1.php 中创建Form: 复制代码 代码如下: //显示上传状态和图片 <div id="showimg"></div...

PHP如何得到当前页和上一页的地址?

$_SERVER['HTTP_REFERER'] //可以得到上一页的地址  $_SERVER[PHP_SELF] //得到当前页面地址  $_S...

PHP中spl_autoload_register()和__autoload()区别分析

PHP中spl_autoload_register()和__autoload()区别分析

关于spl_autoload_register()和__autoload(),相信大多数都会选择前者了? 看两者的用法: 复制代码 代码如下://__autoload用法function...

PHP自带函数给数字或字符串自动补齐位数

先来看个例子:需求为生成4位数,不足前面补0 <?php //生成4位数,不足前面补0 $var=sprintf("%04d", 2); echo $var;/...