<li class="content" id="pre_1152190443"> <font face="新宋体"><span style="COLOR: #ff8000">//返回最佳图片的高度,宽度。以及原来的高度和宽度 <br>//$SrcH:原高度,$SrcW:原宽度,$DstH:目标高度,$DstW:目标宽度 <br>//调用时用 list($SrcW,$SrcH,$DstW,$DstH) = RtImageSize($ImgFile,200,200) <br></span><span style="COLOR: #007700">function </span><span style="COLOR: #0000bb">RtImageSize</span><span style="COLOR: #007700">(</span><span style="COLOR: #0000bb">$ImgFile</span><span style="COLOR: #007700">,</span><span style="COLOR: #0000bb">$ImgW</span><span style="COLOR: #007700">,</span><span style="COLOR: #0000bb">$ImgH</span></font><font face="新宋体"><span style="COLOR: #007700">) <br>{ <br> if(</span><span style="COLOR: #0000bb">file_exists</span><span style="COLOR: #007700">(</span><span style="COLOR: #0000bb">$ImgFile</span></font><font face="新宋体"><span style="COLOR: #007700">)) <br> { <br> </span><span style="COLOR: #0000bb">$Size </span><span style="COLOR: #007700">= @</span><span style="COLOR: #0000bb">GetImageSize</span><span style="COLOR: #007700">(</span><span style="COLOR: #0000bb">$ImgFile</span></font><font face="新宋体"><span style="COLOR: #007700">); <br> </span><span style="COLOR: #0000bb">$SrcW </span><span style="COLOR: #007700">= </span><span style="COLOR: #0000bb">$Size</span><span style="COLOR: #007700">[</span><span style="COLOR: #0000bb">0</span></font><font face="新宋体"><span style="COLOR: #007700">]; <br> </span><span style="COLOR: #0000bb">$SrcH </span><span style="COLOR: #007700">= </span><span style="COLOR: #0000bb">$Size</span><span style="COLOR: #007700">[</span><span style="COLOR: #0000bb">1</span></font><font face="新宋体"><span style="COLOR: #007700">]; <br> </span><span style="COLOR: #0000bb">$Ratio </span><span style="COLOR: #007700">= </span><span style="COLOR: #0000bb">max</span><span style="COLOR: #007700">(</span><span style="COLOR: #0000bb">$SrcW</span><span style="COLOR: #007700">/</span><span style="COLOR: #0000bb">$ImgW</span><span style="COLOR: #007700">,</span><span style="COLOR: #0000bb">$SrcH</span><span style="COLOR: #007700">/</span><span style="COLOR: #0000bb">$ImgH</span></font><font face="新宋体"><span style="COLOR: #007700">); <br> </span><span style="COLOR: #0000bb">$DstW </span><span style="COLOR: #007700">= (</span><span style="COLOR: #0000bb">$SrcW </span><span style="COLOR: #007700">/ </span><span style="COLOR: #0000bb">$Ratio</span></font><font face="新宋体"><span style="COLOR: #007700">); <br> </span><span style="COLOR: #0000bb">$DstH </span><span style="COLOR: #007700">= (</span><span style="COLOR: #0000bb">$SrcH </span><span style="COLOR: #007700">/ </span><span style="COLOR: #0000bb">$Ratio</span></font><font face="新宋体"><span style="COLOR: #007700">); <br> } <br> return array(</span><span style="COLOR: #0000bb">$SrcW</span><span style="COLOR: #007700">,</span><span style="COLOR: #0000bb">$SrcH</span><span style="COLOR: #007700">,</span><span style="COLOR: #0000bb">$DstW</span><span style="COLOR: #007700">,</span><span style="COLOR: #0000bb">$DstH</span></font><span style="COLOR: #007700"><font face="新宋体">); <br>} </font></span> </li> <p style="width:100%;text-align:center;margin:10px 0"> <br> <br> </p> <p style="width:100%;text-align:center;margin:10px 0"> </p> <p class="clear"></p>