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开发的9条建议

本文只是个人从实际开发经验中总结的一些东西,并不是什么名言警句,写出来有两个目的:一是时刻提醒自己要按照这些知识点来写自己代码,二是为了分享,说不定对你有用呢?万一,是吧。。。 1.首要...

无JS,完全php面向过程数据分页实现代码

复制代码 代码如下: <?php //登陆页面设置的session,当session中存在name时 //session_start(); //$name = $_SESSION[...

PHP与javascript实现变量交互的示例代码

本例是PHP和javascript交互的例子,php中的值赋给js变量中,前提是这个php变量必须有值才行,就算是假分支中。比如php中的$flags在本例中为true,如果js中fal...

php 无限分类的树类代码

复制代码 代码如下:<?php /** by lenush; */ class Tree { var $data = array(); var $child = array(-1=...

PHP精确到毫秒秒杀倒计时实例详解

PHP精确到毫秒秒杀倒计时实例详解

精确到毫秒秒杀倒计时PHP源码实例,前台js活动展示倒计时,后台计算倒计时时间。每0.1秒定时刷新活动倒计时时间。 PHP: // 注意:php的时间是以秒算。js的时间以毫秒算...