森林之原
五月 23, 2012, 10:54:34 pm *
歡迎光臨, 訪客. 請先 登入註冊一個帳號.

請輸入帳號, 密碼以及預計登入時間
新聞: CPG 1.4.3 繁體中文完成,請到 CPG 的版面下載。
 
   首頁   說明 搜尋 日曆 登入 註冊  
頁: [1]   向下
  寄送主題  |  列印  
作者 主題: Re: 上傳時重建圖片大小  (閱讀 3327 次)
0 會員 以及 2 訪客 正在閱讀本篇主題.
itski
訪客
« 於: 一月 06, 2005, 09:38:46 am »

來源: http://open.38.com/index.php/topic,342.0.html

改好了   跟大家分享一下    並且補充那篇文章不清楚的部分
參考文章http://coppermine.sourceforge.net/board/index.php?topic=9159.0

首先  改Big5.php的地方  這是我自己改的   翻的不好請原諒
程式碼:
'what_rebuild' => '重建縮圖,調整影像大小和照片原始大小',
          'thumbs_wait' => '更新縮圖 且/或 調整/原來影像尺寸, 請稍待... ',
          'thumbs_continue_wait' => '繼續 更新縮圖 且/或 調整/原來影像尺寸... ',
          'update' => '更新縮圖 且/或 調整影像大小或原始尺吋 ',
          'update_originals' => '將原來照片縮小到設定允許上傳的最大長和寬.',  (此行我直接置於上面這一行的下方)



util.php file 的部分     文章中提到的我則是放在以下的地方
程式碼:
---------找到-------------------------------------
 $imagesize = getimagesize($image);
            if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate']) {
                if (resize_image($image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use'])) {
                    print $normal . $lang_util_php['updated_succesfully'] . '!<br />';
                    my_flush();
                } else {
                    print $lang_util_php['error_create'] . ':$normal<br />';
                    my_flush();
                }
            }
        }
----------------------------在下面,加上----------------------------------

        // *** START *** Original Resize Mod ***

        if ($updatetype == 3) {
            $original = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . mysql_result($result, $i, "filename");
$temp_original = $CONFIG['fullpath'] . mysql_result($result, $i, "filepath") . "temp_" . mysql_result($result, $i, "filename");

            $imagesize = getimagesize($image);
            if (max($imagesize[0], $imagesize[1]) > $CONFIG['max_upl_width_height']) {

            if (rename($original, $temp_original) &&
            copy($temp_original, $original) &&
            unlink($temp_original) &&
            resize_image($image, $original, $CONFIG['max_upl_width_height'], $CONFIG['thumb_method'], $CONFIG['thumb_use'])) {

            // need to save new size of original to database!
                $imagesize = getimagesize($original);
                $pid = mysql_result($result, $i, "pid");
                        $update = "pwidth = " .  (int) $imagesize[0];
            $update .= ", pheight = " . (int) $imagesize[1];
            $update .= ", filesize = " . (int) filesize($original);
                $query = "UPDATE {$CONFIG['TABLE_PICTURES']} SET $update WHERE pid='$pid' LIMIT 1";
                $result_resize = db_query($query);
                print $original .' '. $lang_util_php['updated_succesfully'] . '!<br />';
                my_flush();
            } else {
                print $lang_util_php['error_create'] . ':$original<br />';
                my_flush();
            }

            }
        }

        // *** END *** Original Resize Mod ***







希望能對想裝此外掛的人幫上一些忙
« 最後編輯時間: 一月 06, 2005, 10:09:04 am 由 Andrew » 向版主檢舉   已記錄
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 回覆文章 #1 於: 一月 06, 2005, 10:07:50 am »

多謝你的分享 smiley01_042
向版主檢舉   已記錄

頁: [1]   向上
  寄送主題  |  列印  
 
前往:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006, Simple Machines LLC Valid XHTML 1.0! Valid CSS!