PHP用流方式制作缩略图_PHP教程

php中文网
发布: 2016-07-15 13:23:22
原创
989人浏览过

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

@@######@@

使用的时候可以把在html文件里加上:PHP用流方式制作缩略图_PHP教程

showpic.php及上面的那个php文件,id=xxx是数据库里的记录ID,width是缩略图的宽,height是缩略图的高,请不要同时宽高都上,例如,你要实现宽为50的缩略图,只要PHP用流方式制作缩略图_PHP教程这样就可以了。

(责任编辑:

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/446847.htmlTechArticle其中db_mysql.inc.php,config.php,function.php不是真正使用到的,关键是$filename 文件名,我是通过读取数据库中的图片名称。 include_once ('inc/db_mysql...
<p><?php<br>include_once ('inc/db_mysql.inc.php');<br>include_once ('inc/config.php');<br>include_once ('class/function.php');</p><p>global $picPath;</p><p>if (strstr($_SERVER[HTTP_USER_AGENT],"MSIE")) {<br>$attachment = '';<br>} else {<br>$attachment = ' atachment;';<br>}</p><p><span>立即学习</span>“<a href="https://pan.quark.cn/s/7fc7563c4182" style="text-decoration: underline !important; color: blue; font-weight: bolder;" rel="nofollow" target="_blank">PHP免费学习笔记(深入)</a>”;</p><p>$image = getInfo('newssp_gallery','id',$_GET['id']);</p><p>$filename = $picPath.$image['filename'];</p>
                    <div class="aritcle_card">
                        <a class="aritcle_card_img" href="/ai/2295">
                            <img src="https://img.php.cn/upload/ai_manual/001/246/273/175712873744733.png" alt="清程爱画">
                        </a>
                        <div class="aritcle_card_info">
                            <a href="/ai/2295">清程爱画</a>
                            <p>AI图像与视频生成平台,拥有超丰富的工作流社区和多种图像生成模式。</p>
                            <div class="">
                                <img src="/static/images/card_xiazai.png" alt="清程爱画">
                                <span>170</span>
                            </div>
                        </div>
                        <a href="/ai/2295" class="aritcle_card_btn">
                            <span>查看详情</span>
                            <img src="/static/images/cardxiayige-3.png" alt="清程爱画">
                        </a>
                    </div>
                <p>if (!file_exists($filename)) {<br>$filename = $picPath."notexist.gif";<br>}</p><p>header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1<br>header("Cache-Control: post-check=0, pre-check=0", false);<br>header("Pragma: no-cache");// HTTP/1.0</p><p>header("Content-disposition:".$attachment." filename=".$image['original']);</p><p>$size = @filesize($filename);</p><p>header("Content-Length: $size");</p><p>$fd = @fopen($filename,rb);<br>$contents = @fread($fd,$size);<br>@fclose ($fd);</p><p>echo $contents;<br>?></p>
登录后复制
相关标签:
php
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号