php缩略图
2024-08-27 04:02:33
/*引入文件Easyphpthumbnail.class.php
引用地址:http://www.itdaodan.com/article-detail-id-252.html
*/
class Thumb{
protected $thumblocation =
'Attachment/thumbs/'
;
protected $size_icon = array (
'72'
=>
'72'
,
'96'
=>
'96'
,
'144'
=>
'144'
);
protected $size_logo = array (
'480'
=>
'800'
,
'720'
=>
'1280'
,
'800'
=>
'1280'
,
'1080'
=>
'1920'
);
/**
* @todo 缩略图
* @param array $image
* @param array $size
* @return boolean
*/
public
function
thumbnail ($image ,$size){
if
(empty ($image ) || empty ($size )){
return
false
;
}
$image = (array)$image;
$size = (array)$size;
$thumb =
new
\Think\Easyphpthumbnail ;
$thumb -> Thumblocation = $
this
->thumblocation ;
foreach ($image as $k=>$v){
foreach ($size as $key=>$val){
$thumb -> Thumbprefix = $key.
'_'
;
$thumb -> Thumbheight = $val;
$thumb -> Thumbwidth = $key;
$thumb -> Createthumb ($v,
'file'
);
}
}
return
true
;
}
}
最新文章
- U3D DrawCall优化手记
- [LeetCode] First Bad Version 第一个坏版本
- 使用Githua管理代码
- JQuery入门——进度条
- HDU1269 迷宫城堡
- Codeforces Gym 101138 D. Strange Queries
- ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 G. Garden Gathering
- UVA 11865 Stream My Contest(最小树形图)
- JSON解析保存在类中
- &;quot;蓝筹&;quot;如何使程序猿?
- MooTools 异步请求验证
- Hide a file in a picture
- gulp脚本编写方法
- UVA - 12001 UVa Panel Discussion
- c#字符编码,System.Text.Encoding类,字符编码大全:如Unicode编码、GB18030、UTF-8,UTF-7,GB2312,ASCII,UTF32,Big5
- HeadFirst设计模式读书笔记之策略模式
- 初识正则表达式matcher.group
- Linux操作系统df相关问题解惑
- 嵌套RecyclerView左右滑动替代自定义view
- linux crontab定时器