|
phpThumb, an image processing script, has been installed today. It allows us to reduce image size before sent to browser. This significantly reduce page loading time as smaller image is transfered when no big image is needed. the script also cache the processed files, imptoving the speed enven further.
The first application of this function is the conveyer belt image show on top of the home page. All images were downloaded in full size but reduced at the browser end wasting bandwidth. Now the images are resized before sent to the browser.
Here is the conveyer belt code:
In this code the image fetching part is changed from
- [node]
- leftrightslide[{order}-1]='<a href={link} target=_blank> <img height= 80 src={imgfile} border=1 title="{subject} - {author}"> </a>'
- [/node]
复制代码
to
-
- [node]
- leftrightslide[{order}-1]='<a href={link} target=_blank> <img src=../phpthumb/phpThumb.php?src=../discuz/{imgfile}&h=80&fltr[]=usm|80|0.5|3 border=1 title="{subject} - {author}"> </a>'
- [/node]
复制代码
Note, relative path is used here (it took a while to make this right). |
|