zoukankan      html  css  js  c++  java
  • PHP按比例生成縮略圖片

      一個頁面,列出幾百個頭像的圖標,。尺寸是64x64的,而我有全部圖標的160x160尺寸的,如果全部加載大圖標,那頁面顯示比較慢,那我就需要做出一份小圖標,如下:

    set_time_limit(0);
    $handle = opendir('icon/.');
    while( false !== ($file = readdir($handle)) ){
        if($file != '.' && $file != '..'){
            $im  = imagecreatefromjpeg('./icon/'.$file);
            $pic = imagecreatetruecolor(64,64);
            imagecopyresampled($pic,$im,0,0,0,0,64,64,160,160);
            imagejpeg($pic,'./icon64/'.$file,100);
        }
        
    }
    echo 'Well Done^-^!';
  • 相关阅读:
    mapreduce 函数入门 三
    *hiho 1475
    hiho 1571
    hiho 1620
    hiho 1613
    centos下nginx配置
    hiho 1617
    hiho 172周
    uva 11584
    hiho1605
  • 原文地址:https://www.cnblogs.com/helin/p/3135310.html
Copyright © 2011-2022 走看看