LOADING STUFF...

PHP批量生成缩略图的代码

技术教程6小时前发布 北陌
20 0 0

PHP批量生成缩略图的代码

缺点:长宽不一的图片会被拉伸变形,不能智能裁切,需要智能裁切的,请自行研究。

$config = array();

$config[path] = “./”;

$config[t_width] = 120;

$config[t_height] = 98;

$config[ignore] = array(“”,”.”,”..”);

$config[prefix] = “thumb_”;

$done = 0;

define(“IMAGE_JPG”, 2);

define(“ENDL”, “n”);

if($handle = opendir($config[path])) {

while(false !== ($file = readdir($handle))) {

if(!array_search($file,$config[ignore])) {

list($im_width, $im_height, $type) = getimagesize($file);

if($type != IMAGE_JPG) {

continue;

}

$op .= “found –

© 版权声明

相关文章

暂无评论

暂无评论...