天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

PHP批量生成縮略圖的代碼

缺點:長寬不一的圖片會被拉伸變形,不能智能裁切,需要智能裁切的,請自行研究。
<?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 -> <a href='{$file}'>$file</a>" . ENDL; 
$im = @imagecreatefromjpeg($file); 
if(!$im) { 
$op .= "fail -> couldn't create sour image pointer." . ENDL; 
continue; 


if(file_exists($config['prefix'] . $file) || substr($file, 0, strlen($config['prefix'])) == $config['prefix']) { 
$op .= "note -> this file has already got a thumbnail." . ENDL; 
continue; 

$to = imagecreatetruecolor($config['t_width'],$config['t_height']); 
if(!$to) { 
$op .= "fail -> couldn't create dest image pointer." . ENDL; 
continue; 


if(!imagecopyresampled($to, $im, 0, 0, 0, 0, $config['t_width'], $config['t_height'], $im_width, $im_height)) { 
$op .= "fail -> couldn't create thumbnail. php fail." . ENDL; 
continue; 


//保存文件 
imagejpeg($to, $config['prefix'] . $file); 
$op .= "done -> created thumb: <a href='{$config['prefix']}{$file}'>{$config['prefix']}{$file}</a>" . ENDL; 
$done++; 



closedir($handle); 
$op .= "fin -> {$done} file(s) written" . ENDL; 
echo "<pre>"; 
echo $op; 
echo "</pre>"; 
exit; 
?>

php技術PHP批量生成縮略圖的代碼,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 精品亚洲国产熟女福利自在线 | 久久aa毛片免费播放嗯啊 | 亚洲国产精品热久久 | 诱受H嗯啊巨肉舍友1V1 | 曰批视频免费40分钟不要钱 | 伊人久99久女女视频精品免 | 伊人久久大香线蕉综合99 | 久久99综合国产精品亚洲首页 | 成年视频国产免费观看 | 中文字幕亚洲欧美日韩2019 | 国产av在线播放 | 99在线精品国自产拍 | 日本少妇无码精品12P | 蜜芽在线播放免费人成日韩视频 | 亚洲无碼网站观看 | 色久久综合视频本道88 | 国产自啪偷啪视频在线 | 99久久久久亚洲AV无码 | 国产久久re6免费热在线 | 男人团apk | 人善交XUANWEN200喷水 | 澳大利亚剧满足在线观看 | 国产AV精品国语对白国产 | 少妇两个奶头喷出奶水了怎么办 | 夜色资源站国产www在线视频 | 动漫美女无衣 | 一区二区三区毛AAAA片特级 | 三级成年网站在线观看 | 亚洲精品无码不卡在线播放he | 狠狠色色综合网站 | 任你躁精品一区二区三区 | 国产精品点击进入在线影院高清 | 伊人精品视频直播 | 亚洲欧美日韩中字视频三区 | 超碰公开在线caopon | 色偷偷av男人的天堂 | 果冻传媒妈妈要儿子 | 美女叉腿掰阴大胆艺术照 | 亚洲视频在线免费 | 国产AV国片精品无套内谢无码 | 好男人好资源在线观看免费视频 |