zoukankan      html  css  js  c++  java
  • 一个简单的在页面处理图片大小的方法

           //Server.MapPath(ImagePath))为取得图片绝对路径
             /// <summary>
            /// 按比例缩小图片(高度按缩小按宽度的缩小比例缩小)
            /// </summary>
            /// <param name="ImageMap">界面显示的Image</param>
            /// <param name="ImagePath">图片虚拟路径</param>
            /// <param name="WidthSize">图片缩小后定下的宽度</param>
            /// <param name="Server">本页的Server</param>
            public void ImageSize(System.Web.UI.WebControls.Image ImageMap, string ImagePath, int WidthSize,System.Web.HttpServerUtility Server)
            {
                System.Drawing.Image Img = System.Drawing.Image.FromFile(Server.MapPath(ImagePath));
                int ImgWidth = Img.Width;
                int ImgHeight = Img.Height;
                ImageMap.ImageUrl = ImagePath;
                if (ImgWidth > WidthSize)
                {
                    ImageMap.Width = WidthSize;
                    ImageMap.Height = WidthSize * ImgHeight / ImgWidth;
                }
            }
  • 相关阅读:
    xtrabackup执行备份要拥有的权限
    CentOS 7 下yum安装xtrabackup备份工具
    MySQL read_only选项的作用
    Linux进程管理命令
    MySQL二进制日志中保存的上下文信息
    MySQLdb的安装
    MySQL The password hash doesn't have the expected format.
    web框架本质
    进程和线程
    good blog
  • 原文地址:https://www.cnblogs.com/cuihongyu3503319/p/624375.html
Copyright © 2011-2022 走看看