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设计模式之观察者模式定义与用法。分享给大家供大家参考,具体如下: <?php /** * Interface Observable * defi...

PHP的preg_match匹配字符串长度问题解决方法

项目中,用preg_match正则提取目标内容,死活有问题,代码测得死去活来。 后来怀疑PHP 的preg_match有字符串长度限制,果然,发现“pcre.backtrack_limi...

php 破解防盗链图片函数

复制代码 代码如下:<?php $url=$_GET['url']; $ext=pathinfo($url,PATHINFO_EXTENSION); if($ext!='jpg'...

PHP在同一域名下两个不同的项目做独立登录机制详解

PHP在同一域名下两个不同的项目做独立登录机制详解

前言 目前有这样一个需求,在一个域名下 如:http://example.com 下,有两个项目,example.com/a/,example.com/b/,这两个项目是相互独立的程序,...

PHP中的array数组类型分析说明

php的数组的key 可以是string类型也可以是integer类型。如果key为一个float类型,会自动的转化为integer类型。 如果没有为一个value指定一个key,int...