php用流方式制作缩略图
来源:互联网 发布:淘宝家具海报 编辑:程序博客网 时间:2024/05/22 15:44
其中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;
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;
?>
使用的时候可以把在html文件里加上
<img src='showpic.php?id=xxx' width='50' height='50'>
showpic.php及上面的那个php文件,id=xxx是数据库里的记录ID,width是缩略图的宽,height是缩略图的高,请不要同时宽高都上,例如,你要实现宽为50的缩略图,只要<img src='showpic.php?id=xxx' width='50'>这样就可以了
- php用流方式制作缩略图
- php用流方式制作缩略图
- php制作缩略图
- php 缩略图封装类 制作缩略图
- 教你用php制作一个缩略图教程
- 使用php制作简单的缩略图
- 用C#制作图片缩略图
- 缩略图制作
- 制作缩略图
- PHP制作图片缩略图、加水印、加字体
- php缩略图...
- php缩略图
- PHP 缩略图
- Android中的缩略图制作
- PPT快速制作缩略图
- python 制作缩略图
- python制作缩略图
- 好用的PHP生产缩略图类
- 在Flash中使用Tween
- 在VB中把字符串转换成Byte数组
- php+odbc+access 数据库操作函数,在windows下测试通过
- php删除文件夹及其文件夹下所有文件
- (根据源码自动生成流程图)AutoFlowchart
- php用流方式制作缩略图
- 教训既是经验 CIO职场八大军规——摘自
- 生活日记--2005.6.19
- 荷
- for循环的探索,当你见到类似于for(s=1000;s<999;s++){s=100;}语句时
- 可复用设计:组件还是类,这是个问题
- 将enter键转换为tab键
- oracle数据库开发的一些经验积累(一)
- 李开复博士写给中国大学生的第一封信