let the images auto fit the table in newbb.
(1). add this function in /include/xoops.js
CODE
//Hack Begin==Add image-autoresizing feature===//
function CaricaFoto(img){
foto1= new Image();
foto1.src=(img);
Controlla(img);
}
function Controlla(img){
if((foto1.width!=0)&&(foto1.height!=0)){
viewFoto(img);
}else{
funzione="Controlla('\"+img+\"')";
intervallo=setTimeout(funzione,20);
}
}
function viewFoto(img){
largh=foto1.width;
altez=foto1.height;
stringa="width="+largh+",height="+altez;
finestra=window.open('','',stringa);
finestra.document.write ("<html><body leftmargin=0 topmargin=0>");
finestra.document.write ("<a href='java script:this.close()'><img border=0 src=");
finestra.document.write (img);
finestra.document.write ("></a></body></html>");
finestra.document.close();
return false;
}
//Hack End/*/
(2).in /class/module.textsanitizer.php
##find:
CODE
$replacements[] = '<img src="\\3" align="\\2" alt="" />';
$replacements[] = '<img src="\\1" alt="" />';
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\\4" align="\\2" alt="\\4" />';
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\\2" alt="\\3" />';
##replace it with:
CODE
$replacements[] = "<a href='java script:CaricaFoto(\"\\3\");'><img src='\\3' align='\\2' alt='点击查看大图' border=0 onload=\"java script:if(this.width>screen.width-540)this.width=screen.width-500\" /></a><br>";
$replacements[] = "<a href='java script:CaricaFoto(\"\\1\");'><img src='\\1' alt='点击查看大图' border=0 onload=\"java script:if(this.width>screen.width-540)this.width=540\" /></a><br>";
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\\4" align="\\2" alt="\\4" />';
$replacements[] = '<img src="'.XOOPS_URL.'/image.php?id=\\2" alt="\\3" />';
##find :
CODE
$patterns[] = "/java script:/si";
$replacements[] = "java script:";
##move it behand :
CODE
function &xoopsCodeDecode(&$text, $allowimage = 1)
{
$patterns = array();
$replacements = array();
##finish