: t8 @4 k! F+ _5 {, ZASP中如何控制图片大小
2 o: Y/ f# b! t7 S' Q( I( q4 i: h! c, u$ q4 [
. o. S, _+ |2 y
ASP中如何控制图片大小,(如何实现等比缩放)?
3 |7 Y* b) [% Q0 |+ w
faq-it.org/unix/---------------------------------------------------------------
( X4 u6 l2 l- y3 c: c# T
* M% M' ~, `0 r1 G: D4 u放入head里面
5 I o0 ]" n$ s2 V
<script language="JavaScript">
1 M) R Y3 y- l* V
<!--
" e5 Y/ F* X2 U a
var flag=false;
: U! R% @. @1 |function DrawImage(ImgD){
9 m' ?* N, s3 K$ r8 _1 K# g
var image=new Image();
8 I6 c( ]! m2 ~/ Z* n
image.src=ImgD.src;
) C& H# b( F* c5 U9 j, f$ s if(image.width>0 && image.height>0){
, i- Q: I5 b. N% N) Z6 c flag=true;
, a, q$ T( l1 \: s/ c; l
if(image.width/image.height>= 164/112){
" s2 G2 X9 t: Y* A" i& I) A
if(image.width>164){
: R$ ^. d% L/ T! L- b5 O+ m' B
ImgD.width=164;
2 G5 z _) g8 a ImgD.height=(image.height*164)/image.width;
0 L2 r& x+ [8 r1 |
}else{
M: k5 i1 l$ P ImgD.width=image.width;
$ s2 M1 i4 n9 P; A5 ?4 ^% o0 {
ImgD.height=image.height;
' i+ b7 p/ V* _0 D- @/ `. I# N1 s9 E }
( ^3 e) S9 F A7 s* ~$ w3 a; a1 \ ImgD.alt=image.width+"×"+image.height;
" u" I6 G) Z: X2 u, f& y
}
+ C2 S4 O8 K# |/ h% E2 ~; D c else{
" O; p6 _* c, ^1 P* l1 e* d: c* |* O if(image.height>112){
1 q# F' U" Q5 m" S
ImgD.height=112;
% S# o8 q1 y% ]' B! q9 g2 q ImgD.width=(image.width*112)/image.height;
* h" q3 ^/ E- ]" t2 ^( J }else{
8 i( }8 ~1 E, d) {; C ImgD.width=image.width;
8 y- |" u: w1 V4 u, ^# z+ ]5 }" A- }
ImgD.height=image.height;
! m6 q- g4 X( V) U }
0 n4 h- G' l; h) w8 V& N
ImgD.alt=image.width+"×"+image.height;
+ u$ C1 U. A* J/ K' Y% h) _
}
; `6 M- _/ {7 G& U$ n- v# p, P }
5 p& |$ U: W, c5 N
}
2 N* x# \$ ~+ E% U. h/ @& x//-->
1 M$ X. t+ i9 M9 `3 |5 j& C0 P
</script>
5 l' v# _: _/ D4 v ]0 f o
1 N7 n8 i: o0 `0 j* L图片调用
N! B2 U3 B# |- S1 `5 W
<a href="<%=trim(rs("picurl"))%>" target="_blank"><img src="<%=trim(rs("imgurl"))%>" border="0" width="164" height="112" ></a>
0 V! I" F- Y1 I* |0 J
5 h0 Y) F2 |4 _/ K8 i) B这样可以实现等比例缩放!