PHP技术进阶:php用流方式制作缩略图
来源:百度文库 编辑:神马文学网 时间:2024/04/29 11:03:56
PHP技术进阶:php用流方式制作缩略图
其中db_mysql.inc.php,config.php,function.php不是真正使用到的,关键是$filename 文件名,我是通过读取数据库中的图片名称
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文件里加上
showpic.php及上面的那个php文件,id=xxx是数据库里的记录ID,width是缩略图的宽,height是缩略图的高,请不要同时宽高都上,例如,你要实现宽为50的缩略图,只要这样就可以了
搜索更多相关主题的帖子:进阶缩略phpPHP技术
其中db_mysql.inc.php,config.php,function.php不是真正使用到的,关键是$filename 文件名,我是通过读取数据库中的图片名称
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文件里加上
showpic.php及上面的那个php文件,id=xxx是数据库里的记录ID,width是缩略图的宽,height是缩略图的高,请不要同时宽高都上,例如,你要实现宽为50的缩略图,只要这样就可以了
搜索更多相关主题的帖子:进阶缩略phpPHP技术
PHP技术进阶:php用流方式制作缩略图
PHP技术进阶 用PHP处理多个同名复选框
缩略图生成的php程序
php 使用GD库创建图片缩略图
php
footer.php制作流程
index.php制作流程
PHP上传、生成缩略图、生成文字水印和图片水印
PHP magic_quotes_gpc的正确处理方式
搜索引擎技术核心揭密(PHP)
搜索引擎技术核心揭密(PHP)
搜索引擎技术核心揭密(PHP)
搜索引擎技术核心揭密(PHP)
sajax.php在php中实现ajax技术的类
sajax.php在php中实现ajax技术的
sajax.php在php中实现ajax技术的类
用eAccelerator加速php
用PHP读取和编写XML DOM -- PHP China-中国PHP开源技术|新闻|软件|服务|培训|支持|产品|Zend官方论坛网站
自己动手制作动态网站ASP.PHP.JSP
PHP中动态HTML的输出技术
用php_screw为php加密
用 PHP 获得浏览器信息?
用php连接oracle数据库
wordpress主题制作教程6?–?sidebar.php制作流程