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 str_pad() 将字符串填充成指定长度的字符串

/** * 将字符串填充成指定长度的字符串(多字节安全) * @param string $str 指定被填充的字符串 * @param int $len 指定被填充的字符串的长度,如果...

php fsockopen中多线程问题的解决办法[翻译]

问题: 有没有办法在php中实现多线程呢? 假设你正在写一个基于多台服务器的php应用,理想的情况时同时向多台服务器发送请求,而不是一台接一台。 可以实现吗? 回答: 当有人想要实现并发...

基于PHP5魔术常量与魔术方法的详解

魔术常量:1。__LINE__返回文件中的当前行号。2。__FILE__  返回文件的完整路径和文件名。如果用在包含文件中,则返回包含文件名。自PHP4.0.2 起,__FILE__总是...

php 小乘法表实现代码

复制代码 代码如下:<?php for($i=1;$i<10;$i++) { for($j=1;$j<=$i;$j++) { $result = $i*$j; if(s...

php5 图片验证码实现代码

GD库的函数 1,imagecreatetruecolor -----创建一个真彩色的图像 imagecreatetruecolor(int x_size,int y_size) //x...