cs中
protected
string
GetUrlWH(
string
url)
...
{ string sPath = Server.MapPath(url); System.Drawing.Image img = System.Drawing.Image.FromFile(sPath); int width = img.Width; int height = img.Height; if (width > 100) width = 90; if (height > 120) height = 90; return "style='width:" + width + ";height:" + height + "'"; }
这个写在模板列中:
<img src=<%#Eval("url")%> <%#GetUrlWH(Eval("url").ToSTring())%> >
转载请注明原文地址: https://ibbs.8miu.com/read-12174.html