第 1 頁 (共 2 頁)
[問題]關於自動縮圖的mod
發表於 : 2004-01-10 11:09
由 hihihihi
請問為什麼我試過數款縮圖的mod到我的phpBB2.06,沒一個能用的呢??
就如下面這兩個mod,第一次進入主題時會自動縮圖,但當我按重新整理時圖片就會變回原本大小,請問現在有沒有比較好的縮圖mod可以用在2.06版本??
打開
templates/your template/bbcode.tpl
<!-- BEGIN img --><a href="{URL}" target="_blank" title="開新視窗賞圖"><img src="{URL}" border="0" onload="javascript:if(this.width>screen.width-333) this.width=screen.width-333" /></a><!-- END img -->
or
<!-- BEGIN img --><a href="{URL}" target="_blank"><img src="{URL}" border="0" OnLoad='if(this.width > 640 || this.height > 480) if((this.width / this.height) > (640/480)) {this.width=640} else {this.height=480}' /></a><br><!-- END img -->
發表於 : 2004-01-10 11:18
由 atthis
發表於 : 2004-01-10 13:24
由 小竹子
代碼: 選擇全部
<!-- BEGIN img --><a href="{URL}" target="_blank" title="開新視窗賞圖"><img src="{URL}" border="0" onload="javascript:if(this.width>screen.width-333) this.width=screen.width-333" /></a><!-- END img -->
這個應該可以吧!
把333改成400
我記得我好像有回過這個文章
發表於 : 2004-01-10 14:22
由 hihihihi
哇,這個mod好像很不錯,但是它只可以限制圖片的寬度,請問有沒有是可以限制圖片的高和寬的mod呢??謝謝
發表於 : 2004-01-10 14:32
由 hihihihi
小竹子 寫:代碼: 選擇全部
<!-- BEGIN img --><a href="{URL}" target="_blank" title="開新視窗賞圖"><img src="{URL}" border="0" onload="javascript:if(this.width>screen.width-333) this.width=screen.width-333" /></a><!-- END img -->
這個應該可以吧!
把333改成400
我記得我好像有回過這個文章
我的問題不是大小的問題,而是有時候當我重新載入頁面時圖片會自動變回原本的大小而不懂得縮圖,請問怎樣解決這個問題呢???
發表於 : 2004-01-10 17:56
由 atthis
hihihihi 寫:哇,這個mod好像很不錯,但是它只可以限制圖片的寬度,請問有沒有是可以限制圖片的高和寬的mod呢??謝謝
你裝了嗎?
還沒裝的話,裝到\r
代碼: 選擇全部
#
#-----[ OPEN ]------------------------------------------------
#
includes/bbcode.php
#
#-----[ FIND ]------------------------------------------------
#
global $lang, $bbcode_tpl;
#
#-----[ REPLACE WITH ]----------------------------------------
#
// Start replacement - LargeImages MOD
global $lang, $bbcode_tpl, $board_config;
// Start replacement - LargeImages MOD
#
#-----[ FIND ]------------------------------------------------
#
$text = preg_replace($patterns, $replacements, $text);
時將原本要加進去的
代碼: 選擇全部
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// Start add - LargeImages MOD
if (!empty($board_config['image_max_width']) && ($board_config['image_max_width'] > 0))
{
if (preg_match_all("#\[img:$uid\](.*?)\[/img:$uid\]#si", $text, $images)) {
$imagePatterns = $imageReplacements = array();
foreach($images[1] as $index=>$image_link)
{
$image_dimensions = @getimagesize($image_link);
if ($image_dimensions && $image_dimensions[0] > $board_config['image_max_width']) {
$div_height = $image_dimensions[1] + 20;
$imagePatterns[] = $images[0][$index];
$imageReplacements[] = '<div style="width:'.$board_config['image_max_width'].'px; height:'.$div_height.'px; overflow:auto;">'.$images[0][$index].'</div>';
}
}
$text = str_replace($imagePatterns,$imageReplacements,$text);
}
}
// End add - LargeImages MOD
改成
代碼: 選擇全部
#
#-----[ BEFORE, ADD ]-----------------------------------------
#
// Start add - LargeImages MOD
if (!empty($board_config['image_max_width']) && ($board_config['image_max_width'] > 0))
{
if (preg_match_all("#\[img:$uid\](.*?)\[/img:$uid\]#si", $text, $images)) {
$imagePatterns = $imageReplacements = array();
foreach($images[1] as $index=>$image_link)
{
$image_dimensions = @getimagesize($image_link);
if ($image_dimensions && ($image_dimensions[0] > $board_config['image_max_width'] || $image_dimensions[1] > [color=red]500[/color])) {
$div_height = [color=red]500[/color];
$imagePatterns[] = $images[0][$index];
$imageReplacements[] = '<div style="width:'.$board_config['image_max_width'].'px; height:'.$div_height.'px; overflow:auto;">'.$images[0][$index].'</div>';
}
}
$text = str_replace($imagePatterns,$imageReplacements,$text);
}
}
// End add - LargeImages MOD
紅色部分請改成你自已要限制的高度
發表於 : 2004-01-11 04:32
由 依夢兒
hihihihi 寫:我的問題不是大小的問題,而是有時候當我重新載入頁面時圖片會自動變回原本的大小而不懂得縮圖,請問怎樣解決這個問題呢???
這是 JavaScript 本身的問題。
當網友第一次瀏覽圖片後,這一張圖片就會儲存在網友的 cache 資料夾內。
下一次網友再看到這一張圖片(或是經過 reload 的動作),圖片會直接從 cache 資料中呼叫出來,於是縮圖的語法就失效了。
簡單的說,這是該外掛本來就有的缺點。
最近有一支縮圖外掛就沒有這個問題了,你可以試試:
http://www.phpbb.com/phpBB/viewtopic.php?t=146844
效果(請用滑鼠點一下圖片):
http://matrix-explained.com/php/viewtop ... =3664#3664
發表於 : 2004-01-11 05:12
由 GeniusKiKi
可是這樣似乎會影響到 [url] 語法與 [img] 共存時的使用
發表於 : 2004-01-11 05:15
由 文
我最近也很困擾,那個語法常常失效!
另外atthis你提到的那個東西是?
你裝了嗎?
還沒裝的話,裝到
發表於 : 2004-01-11 08:56
由 atthis
文 寫:另外atthis你提到的那個東西是?
你裝了嗎?
還沒裝的話,裝到
就是這個
http://phpbb-tw.net/phpbb/viewtopic.php?t=19910
我第二篇回它的
還有我昨天考慮欠周詳
把那一段改成這樣會比較好\r
代碼: 選擇全部
// Start add - LargeImages MOD
if (!empty($board_config['image_max_width']) && ($board_config['image_max_width'] > 0))
{
if (preg_match_all("#\[img:$uid\](.*?)\[/img:$uid\]#si", $text,$images)) {
$imagePatterns = $imageReplacements = array();
foreach($images[1] as $index=>$image_link)
{
$image_dimensions = @getimagesize($image_link);
if ($image_dimensions && ($image_dimensions[0] > $board_config['image_max_width'] || $image_dimensions[1] > [color=red]500[/color]) ) {
$div_width = ($image_dimensions[0] > $board_config['image_max_width']) ? $board_config['image_max_width'] : $image_dimensions[0] + 20;
$div_height = ($image_dimensions[1] > [color=red]500[/color]) ? [color=red]500[/color] : $image_dimensions[1] + 20;
$imagePatterns[] = $images[0][$index];
$imageReplacements[] = '<div style="width:'.$div_width.'px; height:'.$div_height.'px; overflow:auto;">'.$images[0][$index].'</div>';
}
}
$text = str_replace($imagePatterns,$imageReplacements,$text);
}
}
// End add - LargeImages MOD
紅色的部分是要限制的高度\r
Demo:
http://chianglab.bio.ncku.edu.tw/phpBB2 ... .php?t=307
ps.為了明顯高度限制的效果,Demo的預設高度限制為200
發表於 : 2004-01-12 23:28
由 hihihihi
謝謝您,等一下再試試.....
發表於 : 2004-03-15 15:25
由 webspirit
這個mod有很嚴重的缺點
就是當頁面的圖很多的時候會讓人等到抓狂!
有時還會讓你發生找不到網頁的現象
不信 一頁貼個二十張圖試試
把這功能關閉就不會了
發表於 : 2004-03-18 18:50
由 都市農夫
有沒有中文的介紹及下載呢﹐英文實在太爛﹐不好意思 謝謝
發表於 : 2004-03-18 20:11
由 依夢兒
都市農夫 寫:有沒有中文的介紹及下載呢﹐英文實在太爛﹐不好意思 謝謝
沒有,請善用網路上已有的翻譯服務網站。
發表於 : 2004-03-18 21:00
由 GeniusKiKi