gpt4 book ai didi

c# - Fine Uploader session 缩略图加载缓慢

转载 作者:行者123 更新时间:2023-11-30 21:49:36 25 4
gpt4 key购买 nike

我正在使用 Fine Uploader 为社区网站创建模型文件上传工具。

我已将 session 设置为从服务器检索初始文件以及缩略图 url。

一切都很好,但是缩略图的渲染真的很慢。我不知道为什么。所以我硬编码为四个文件中的每一个都使用一个非常小的缩略图。这没有区别。

服务器端不是问题。信息返回的速度非常快。

我做错了什么吗?为什么 fineuploader 这么慢?这是屏幕抓取。渲染四个缩略图需要四秒钟。

fine uploader rendering thumbs

我正在使用最新的 chrome。这是一个功能相当强大的机器上的 NancyFX 项目。渲染带有大图像的其他页面非常快捷。

客户端代码:

thumbnails: {
placeholders: {
waitingPath: '/Content/js/fine-uploader/placeholders/waiting-generic.png',
notAvailablePath: '/Content/js/fine-uploader/placeholders/not_available-generic.png'
}
},
session: {
endpoint: "/getfiles/FlickaId/342"
},

服务器端代码:

        // Fine uploader makes session request to get existing files
Get["/getfiles/FlickaId/{FlickaId}"] = parameters =>
{
//get the image files from the server
var i = FilesDatabase.GetFlickaImagesById(parameters.FlickaId);

// list to hold the files
var list = new List<UploadedFiles>();

// build the response data object list
foreach (var imageFile in i)
{
var f = new UploadedFiles();

f.name = "test-thumb-small.jpg"; // imageFile.ImageFileName;
f.size = 1;
f.uuid = imageFile.FileGuid;
f.thumbnailUrl = "/Content/images/flickabase/thumbnails/" + "test-thumb-small.jpg"; // imageFile.ImageFileName;

list.Add(f);
}

return Response.AsJson(list); // our model is serialised by Nancy as Json!

};

最佳答案

这是设计使然,其实现既是为了防止 UI 线程被图像缩放逻辑淹没,也是为了防止 Chrome 特有的内存泄漏问题。这在文档的缩略图和预览部分进行了解释,特别是在 the "performance considerations" area 中。 :

For browsers that support client-generated image previews (qq.supportedFeatures.imagePreviews === true), a configurable pause between template-generated previews is in effect. This is to prevent the complex process of generating previews from overwhelming the client machine's CPU for a lengthy amount of time. Without this limit in place, the browser's UI thread runs the risk of blocking, preventing any user interaction (scrolling, etc) until all previews have been generated.

您可以通过 the thumbnails option 调整或删除此暂停,但我建议您不要这样做,除非您确定用户不会丢弃大量复杂的图像文件。

关于c# - Fine Uploader session 缩略图加载缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36823418/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com