next up previous contents
Next: 試題編輯 Up: 用戶 Previous: index.php 程式修改   Contents

用戶相片尺寸

  1. 用戶上傳相片,系統存成 100x100 及 35x35 兩種尺寸,相片存檔尺寸調整,可修改 lib/gdlib.php 的函式 process_new_icon
    [root@dywang moodle23]# egrep -n "(process_new_icon|35)" lib/gdlib.php 
    100:function process_new_icon($context, $component, $filearea, $itemid, $originalfile) {
    174:        $im2 = imagecreatetruecolor(35, 35);
    204:        $im2 = imagecreate(35, 35);
    218:    imagecopybicubic($im2, $im, 0, 0, $cx - $half, $cy - $half, 35, 35, $half * 2, $half * 2);
    
  2. 若不改變己存檔相片尺寸及往後相片存檔的尺寸,只希望改變相片顯示尺寸,可調整顯示尺寸:
    [root@dywang moodle23]#  grep -B1 -A5 'size = 25' ./lib/outputrenderers.php
            if (empty($userpicture->size) or $userpicture->size == 35 ) {
                $size = 25;
            } else if ($userpicture->size === true or $userpicture->size == 1) {
                $size = 100;
            } else {
                $size = $userpicture->size;
            }
    


2017-08-04