一斛珠 by朵朵舞:asp判断图片长宽显示

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 06:50:30
<%
if rs("img")<>"" then
img=split(rs("img"),",")
widthnum=split(rs("width1"),",")
heightnum=split(rs("height1"),",")
photo1=trim(img(0))
photo2=trim(img(1))
photo3=trim(img(2))
width1=trim(widthnum(0))
width2=trim(widthnum(1))
width3=trim(widthnum(2))
height1=trim(heightnum(0))
height2=trim(heightnum(1))
height3=trim(heightnum(2))

if photo1<>"" then
if width1>300 and height1<=300 then
width_1=width1*(300/width1)
gao_1=height1*(300/width1)
elseif width1<=300 and height1>300 then
width_1=width1*(300/height1)
gao_1=height1*(300/height1)
elseif width1>300 and height1>300 and height1<width1 then
width_1=width1*(300/width1)
gao_1=height1*(300/width1)
elseif width1>300 and height1>300 and height1>=width1 then
width_1=width1*(300/height1)
gao_1=height1*(300/height1)
else
width_1=width1
gao_1=height1
end if
Response.Write "<a href='../picture/product/"&photo1&"' target='_blank'><img src='../picture/product/"&photo1&"' border='0' width='"&width_1&"' height='"&gao_1&"' alt='blow up'></a>"

显示出来的图是变形的,谁可以帮我看下那出问题了,图的大小是360*360的

你把数据中 图片的大小 和实际效果中的大小贴出来我看看