如何从C#中的实际图像创建缩略图#

问题描述:

我想从网页上从用户上传的图像创建缩略图。我想创建一个图像库,可以将所有图像预览显示为缩略图,当用户单击时,他可以看到放大的图像。如何从C#中的实际图像创建缩略图#

是否有可能做到这一点,使网页不变得沉重

+0

我找到了一个C#图像调整大小教程。我不知道C#。 http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing – msw 2010-08-01 08:23:14

你或许应该缓存缩略图,而是创造他们看到:

What is the "best" way to create a thumbnail using ASP.NET?

您必须为图像需要的类别标签为缩略图。此这样的:

.thumbnail { 
box-shadow: 0 0 7px #fff; 
cursor: pointer; 
float: left; 
height: 70px; 
margin-bottom: 10px; 
margin-top: -35px; 
width: 70px; 
border: 3px solid #ff``f; 
border-radius: 3px; 

}

等例如:

<img id="Image1" class="thumbnail" src="..." .../> 

和所有图像的CSS调整大小。并为创建放大的图像,你必须使用jquery Modal。为Modal阅读此链接:http://www.jacklmoore.com/colorbox/ 您必须创建一个jquery文件。点击每个图片后,您必须使用您的src调用插件。这样这个jquery:

$('.thumbnail').on('click', function() { 
var src = $(this).attr('src'); 
$(this).colorbox({ html: "<img src='" + src + "'      style='width:1024px;height:728px'/>", width: "1024px", height: "728px", close: "", closeButton: true, scrolling: false, overlayClose: true, scalePhotos: true, escKey: true }); 

});