没有合适的资源?快使用搜索试试~ 我知道了~
PHP简单生成缩略图相册的方法
0 下载量 134 浏览量
2020-12-19
19:52:36
上传
评论
收藏 30KB PDF 举报
温馨提示
![preview](https://dl-preview.csdnimg.cn/13731721/0001-9243f3a961fe17e0cd548ecc5937af99_thumbnail.jpeg)
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
试读
1页
本文实例讲述了PHP简单生成缩略图相册的方法。分享给大家供大家参考。具体如下: <?php /* * written by mot * 根目录下自己新建image thumb目录 * */ class thumb{ private $src; private $source; private $s_width; private $s_height; private $dest; private $d_height; private $d_width; private $name; public function thumb($image_path,$
资源详情
资源评论
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/13731721/bg1.jpg)
PHP简单生成缩略图相册的方法简单生成缩略图相册的方法
本文实例讲述了PHP简单生成缩略图相册的方法。分享给大家供大家参考。具体如下:
<?php
/*
* written by mot
* 根目录下自己新建image thumb目录
* */
class thumb{
private $src;
private $source;
private $s_width;
private $s_height;
private $dest;
private $d_height;
private $d_width;
private $name;
public function thumb($image_path,$rate = 0.5){
$this->src = $image_path;
$this->source = imagecreatefromjpeg($image_path);
$s_size = getimagesize($image_path);
$this->s_height = $s_size[1];
$this->s_width = $s_size[0];
$this->d_height = 100;
$this->d_width = 100;
$this->dest = imagecreate($this->d_width, $this->d_height);
$this->name = explode('.jpg', $image_path);
$this->name = $this->name[0];
}
public function make(){
imagecopyresized($this->dest, $this->source, 0, 0, 0, 0, $this->d_width, $this->d_height,
$this->s_width, $this->s_height);
$thumb = str_replace('image', 'thumb', $this->name.'-thumb.jpg');
imagejpeg($this->dest,$thumb,100);
$img = $thumb;
echo "<a href=$this->src><img src=$img></a>";
}
}
$hl = opendir(".\image\");
while(false != $file = readdir($hl)){
if($file == '.' || $file == '..') continue;
$path = '.\image\'.$file;
$tmp = new thumb($path,0.3);
$tmp->make();
}
希望本文所述对大家的php程序设计有所帮助。
您可能感兴趣的文章您可能感兴趣的文章:php使用timthumb生成缩略图的方法php上传图片生成缩略图(GD库)php动态生成缩略图并输出显示的
方法Thinkphp调用Image类生成缩略图的方法php可生成缩略图的文件上传类实例php实现根据url自动生成缩略图的方法php
实现上传图片生成缩略图示例php 根据url自动生成缩略图并处理高并发问题php利用GD库生成缩略图示例使用gd库实现php
服务端图片裁剪和生成缩略图功能分享PHP实现原比例生成缩略图的方法
![application/x-zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![thumb](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
weixin_38611388
- 粉丝: 10
- 资源: 971
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论0