php用流方式制作缩略图

彼此永不忘GL

彼此永不忘GL

2016-01-29 15:05

php用流方式制作缩略图,php用流方式制作缩略图
 

其中db_mysql.inc.php,config.php,function.php不是真正使用到的,关键是$filename 文件名,我是通过读取数据库中的图片名称

<?php
include_once ('inc/db_mysql.inc.php');
include_once ('inc/config.php');
include_once ('class/function.php');

global $picPath;

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/php/)

if (strstr($_SERVER[HTTP_USER_AGENT],"MSIE")) {
  $attachment = '';
} else {
  $attachment = ' atachment;';
}

$image = getInfo('newssp_gallery','id',$_GET['id']);

$filename = $picPath.$image['filename'];

if (!file_exists($filename)) {
  $filename = $picPath."notexist.gif";
}

header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");                 // HTTP/1.0

header("Content-disposition:".$attachment." filename=".$image['original']);

$size = @filesize($filename);

header("Content-Length: $size");

$fd = @fopen($filename,rb);
$contents = @fread($fd,$size);
@fclose ($fd);

echo $contents;
?

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/php/)

使用的时候可以把在html文件里加上

<img src="http://img.jcwcn.com/attachment/portal"

展开更多 50%)
分享

猜你喜欢

php用流方式制作缩略图

PHP
php用流方式制作缩略图

生成缩略图

Web开发
生成缩略图

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

js实现缩略图功能

Web开发
js实现缩略图功能

用ASPJPEG组件制作图片的缩略图和加水印

ASP
用ASPJPEG组件制作图片的缩略图和加水印

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

无组件生成缩略图

Web开发
无组件生成缩略图

Word缩略图的作用

电脑入门
Word缩略图的作用

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

PHP 5.0 中的对象重载技术研究

PHP 5.0 中的对象重载技术研究

《全民英雄》攻略之60级紫装强化后数据

《全民英雄》攻略之60级紫装强化后数据
下拉加载更多内容 ↓