方法一:使用javascript代码:
<a href="ImageDetail.aspx?id=<%# Eval("ID") %>&type=6">
<img src="UploadData\Image\<%# Eval("ImagePath") %>" onload="javascript:DrawImage(this,140,100);"
width="140px" heigth="100px" /></a>
function DrawImage(MyPic,W,H){
var flag=false;
var image=new Image();
image.src=MyPic.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>= W/H){
if(image.width>W){
MyPic.width=W;
MyPic.height=(image.height*W)/image.width;
}
else{
MyPic.width=image.width;
MyPic.height=image.height;
}
}
else{
if(image.height>H){
MyPic.height=H;
MyPic.width=(image.width*H)/image.height;
}
else{
MyPic.width=image.width;
MyPic.height=image.height;
}
}
}
}
方法二:通过C# 的图片处理类(*注明:下面的类拷贝至hi.baidu.com软件技术博客)
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Collections;
namespace Dakai.DakaiDAL
{
public class ImageHelper
{
/// <summary>
/// 获取图片中的各帧
/// </summary>
/// <param name="pPath">图片路径</param>
/// <param name="pSavePath">保存路径</param>
public void GetFrames(string pPath, string pSavedPath)
&nb |