缺少缩略图动态生成缩略图 [英] Missing thumbnail image generating thumbnails on the fly

查看:181
本文介绍了缺少缩略图动态生成缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么,如果我生成与下面的code,网页中的许多缩略图使他们中的一些缺失始终?我测试IE10和FF21和丢失的图像随时更改。我们与ASP.NET MVC 3工作。

感谢。

  WebImage wbImage =新WebImage(〜/资产/图像/画廊/+ imageName +JPG);INT宽度= 220;wbImage.Resize(宽度,(INT)((双)wbImage.Height *宽/ wbImage.Width));wbImage.FileName = imageName +_ small.jpgwbImage.Write();


解决方案

最好的解决办法是在飞行中如果没有present在磁盘上生成缩略图,并把它们保存到缩略图文件夹中。你需要他们接下来的时间,直接从磁盘读取。

Why if I generate many thumbnail images with the code below, during web page render some of them are always missing? I tested IE10 and FF21 and the missing image always change. We work with ASP.NET MVC 3.

Thanks.

WebImage wbImage = new WebImage("~/assets/images/gallery/"+imageName+".jpg");

int width = 220;

wbImage.Resize(width, (int)((double)wbImage.Height * width / wbImage.Width));

wbImage.FileName = imageName+"_small.jpg";

wbImage.Write();

解决方案

The best solution is to generate thumbnails on the fly if not present on disk and save them into Thumbnail folder. The next time you need them, read directly from disk.

这篇关于缺少缩略图动态生成缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆