Image resizing on the fly in asp.net

前端 未结 4 1554
谎友^
谎友^ 2021-01-14 17:40

For simplicity lets say that I have a web page that needs to display thumbnails of images. The images locations are stored in a database(the images are stored on Amazon S3).

4条回答
  •  花落未央
    2021-01-14 18:29

    Yes.

    You make a ASP.Net page that does Response.Clear(), sets Content-Type-header in Response and sends the binary data of the image (also through Response). The image can be resized on-the-fly, but I'd recommend caching it for some time on disk or so. Then you reference the image from HTML as . For storing image in memory before sending you can use MemStream.

    I have sample code but not in front of me right now, sorry. :)

提交回复
热议问题