缩略图
缩略图
一般而言
OSC目前是將大圖指定尺寸
使得我們獲得“假相”
以為我們的圖是小圖,但是實際傳輸資料依然以大圖的方式做傳輸的動作
今天花了一點時間做了以下的修改
在上傳的時候,程式會自動將圖檔做縮檔的動作,目前的成果是原本19K的檔案變成9K,而在看產品大圖時,會以原圖檔的方式跳出
實作平台:
FreeBSD 4.8-RELEASE
mod_php4-4.3.4.r1,1
ImageMagick-5.5.6_3
我做了以下的程式碼改變:
catalogadminincludesclassesupload.php 96行處起
代碼:
if (substr($this->destination, -1) != '/') $this->destination .= '/';
// lman diff
if (move_uploaded_file($this->file['tmp_name'], $this->destination . 'B_'.$this->filename)) {
// if (move_uploaded_file($this->file['tmp_name'], $this->destination . $this->filename)) {
chmod($this->destination . 'B_'. $this->filename, $this->permissions);
@copy($this->destination . $this->filename,$this->destination . $this->filename);
//small size image
$si = $this->destination . $this->filename;
//big size image
$bi = $this->destination . 'B_'. $this->filename;
$exec_str = "/usr/local/bin/convert -geometry 100x80 ".$bi." ".$si;
@exec($exec_str);
// lman diff end
if ($this->message_location == 'direct') {
catalogpopup_image.php 36行處,修改為
代碼:
<?php echo tep_image(DIR_WS_IMAGES . 'B_' .$products['products_image'], $products['products_name']); ?>
目前我試的效果非常ok
__________________
喜欢php的朋友可以来交流
www.txhb.com
QQ 4313057