【问题标题】:how to create thumbnail from actual image in C#如何在 C# 中从实际图像创建缩略图
【发布时间】:2011-03-23 19:33:03
【问题描述】:

我想从用户在网页上上传的图像创建缩略图。我想创建一个图片库,我可以将所有图片预览显示为缩略图,当用户点击时,他可以看到放大的图片。

是否可以这样做以使页面不重

【问题讨论】:

标签: ajax image image-processing


【解决方案1】:

您可能应该缓存缩略图,但要创建它们,请参阅:

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

【讨论】:

    【解决方案2】:

    您必须为缩略图的图像标签设置一个类。这样的:

    .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。对于模态阅读此链接: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 });
    

    });

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-09-13
      • 2017-09-28
      • 2016-04-19
      • 2010-11-15
      • 1970-01-01
      • 1970-01-01
      • 2010-09-27
      • 1970-01-01
      相关资源
      最近更新 更多