function content_imgsize($content,$imgsize){ $content=str_replace("IMG","img",$content); $content=preg_replace("/<img(.*?)\>/","<img $1 onload=\"sizeX=".$imgsize.";if(this.width>sizeX) {Rate=parseInt(this.width/sizeX);if(Rate>0) {this.width=sizeX;this.height=this.height/Rate;}}\">",$content); return($content); }