摇一摇优惠券开源码/51wsb_weijuan/app_code/imgphoto.cs
(开头部分) 17KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Drawing;
using System.Drawing.Imaging;
public class imgphoto
{
/**/
/// <summary>
/// 按比例缩小图片,自动计算高度
/// </summary>
/// <param name="strOldPic">源图文件名(包括路径)</param>
/// <param name="strNewPic">缩小后保存为文件名(包括路径)</param>
/// <param name="intWidth">缩小至宽度</param>
public void SmallPic(string PicPath, int intWidth)
{
System.Drawing.Bitmap objPic, objNewPic;
try
{
objPic = new System.Drawing.Bitmap(PicPath);
if (objPic.Width >= objPic.Height)
{
if (objPic.Width > intWidth)
{
double tempbl = (double)objPic.Width / objPic.Height;
int intHeight = Convert.ToInt32(Convert.ToDouble(intWidth) / tempbl);
objNewPic = new System.Drawing.Bitmap(objPic, intWidth, intHeight);
objPic.Dispose();
SaveAsJPEG(objNewPic, PicPath, 90); //90图片压缩品质
objNewPic.Dispose();
}
else
{
objPic.Dispose();
}
}
else
{
if (objPic.Height > intWidth)
{
double tempbl = (double)objPic.Height / objPic.Width;
int intHeight = Convert.ToInt32(Convert.ToDouble(intWidth) / tempbl);
objNewPic = new System.Drawing.Bitmap(objPic, intHeight, intWidth);
objPic.Dispose();
后面还有 657 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
