/// <summary>
/// 获取上传的图片
/// </summary>  
public FileResult GetImages(string PhotoPath)
{

    var filename = PhotoPath.ImageUploadPath();//获取图片路径

    if (!string.IsNullOrEmpty(filename))

      {

        FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read);

        int length = (int)fs.Length;

        byte[] image = new byte[length];

        fs.Read(image, 0, length);

        fs.Close();

        return new FileContentResult(image, "image/jpeg");

      }

      else

      {

        return null;

    }

    }

MVC 读取图片的更多相关文章

  1. [转]asp.net mvc 从数据库中读取图片

    本文转自:http://www.cnblogs.com/mayt/archive/2010/05/20/1740358.html 首先是创建一个类,继承于ActionResult,记住要引用Syste ...

  2. asp.net mvc 从数据库中读取图片的实现代码

    首先是创建一个类,继承于ActionResult,记住要引用System.Web.Mvc命名空间,如下: public class ImageResult : ActionResult { publi ...

  3. MVC中根据后台绝对路径读取图片并显示在IMG中

    数据库存取图片并在MVC3中显示在View中 根据路径读取图片: byte[] img = System.IO.File.ReadAllBytes(@"d:\xxxx.jpg"); ...

  4. nodejs进阶(4)—读取图片到页面

    我们先实现从指定路径读取图片然后输出到页面的功能. 先准备一张图片imgs/dog.jpg. file.js里面继续添加readImg方法,在这里注意读写的时候都需要声明'binary'.(file. ...

  5. HTML中上传与读取图片或文件(input file)----在路上(25)

    input file相关知识简例 在此介绍的input file相关知识为: 上传照片及文件,其中包括单次上传.批量上传.删除照片.增加照片.读取图片.对上传的图片或文件的判断,比如限制图片的张数.限 ...

  6. nodeJS基础08:读取图片

    1.读取图片 //server.js var http = require("http"); var readImage = require("./readImage&q ...

  7. opencv用imread( argv[1], 1)读取图片

    显示一幅图:主要是运用功能:imread namedWindow imshowimread:从字面意思我们就可以看懂,用来读取图片的:namedWindow:显然,我们也可以看到这是用来命名窗口名称的 ...

  8. Servlet从本地文件中读取图片,并显示在页面中

    import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpSer ...

  9. [OpenCV] 1、读取图片

    >_<" 安装及配置请看http://www.cnblogs.com/zjutlitao/p/4042074.html >_<" 这篇是一个简单的在VS20 ...

随机推荐

  1. [codevs3296]有序数组合并

    题目描述 Description 合并两个有序数组A和B,使得结果依然有序. 进阶:合并两个有序数组A和B,假设A有n个数,B有m个数,A数组后面还有m个空余空间,需要将结果保存在A中. 请使用O(n ...

  2. 【CSS3】Advanced10:Gradient

    1.background:linear-gradient(20deg/(to) bottom right,orange,red,hsl(60,100%,50%)); 2.-webkit-chrome/ ...

  3. 【HTML】Intermediate2:Text: AbbreviationsQuotations Code

    1.</abbr> attribute:title 2.Quotations blockquote :standalone often multi-line quotations-cite ...

  4. 输入A和B,计算并输出A+B

    EOF是一个预定义的常量,等于-1. 输入A和B,计算并输出A+B Sample input: 1    5 10  20 Sample output: 6 30 #include <iostr ...

  5. Storm系列(七)架构分析之Scheduler-调度器[DefaultScheduler]

    Storm默认的任务调度器.实现如下: 1  (defn –prepare [this conf]) 2  (defn –schedule [this ^Topologies topologies ^ ...

  6. Headless MSBuild Support for SSDT (*.sqlproj) Projects [利用msbuild自动化部署 .sqlproj]- 摘自网络

    Update: breaking change: http://sqlproj.com/index.php/2012/10/dacfx-sept-2012-updates-break-headless ...

  7. ios iphone 将log在终端输出

    对于模拟器,其在终端的log文件位于:   -/Library/Logs/CoreSimulator/C4B94BA6-EF08-4AD2-AE7D-1A3A2E2AC545/system.log 对 ...

  8. A Tour of Go For is Go's "while"

    At that point you can drop the semicolons(分号): C's while is spelled for in Go. package main import & ...

  9. javascript函数库

    //构造缓存函数 var memoizer = function (memo, fundamental) { var shell = function (n) { var result = memo[ ...

  10. JS继承的几种方式

    JS作为面向对象的弱类型语言,继承也是其非常强大的特性之一. 既然要实现继承,那么我们先定义一个父类: // 定义一个动物类 function Animal (name) { // 属性 this.n ...