无法从污染的画布下载图像;我如何下载托管在Amazon s3存储桶中的Seadragon映像?

我有一堆存储在Amazon s3存储桶中的深度缩放图像,我有一个网页,用Open Seadragon dzi查看器显示它们。我能够显示图像,但我无法让他们下载;我收到安全错误,我有一个污染的画布。无法从污染的画布下载图像;我如何下载托管在Amazon s3存储桶中的Seadragon映像?

我设置在桶CORS设定:

<?xml version="1.0" encoding="UTF-8"?> 

<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">

<CORSRule>

<AllowedOrigin>*</AllowedOrigin>

<AllowedMethod>GET</AllowedMethod>

<MaxAgeSeconds>3000</MaxAgeSeconds>

<AllowedHeader>Authorization</AllowedHeader>

</CORSRule>

</CORSConfiguration>

这让我来显示图像(以前我OpenSeadragon调用失败,因为没有访问控制,允许原产头),但我的帆布仍然受到污染。

我尝试设置crossOrigin政策在海龙观众:

var viewer = OpenSeadragon({ 

crossOrigin: "Anonymous",

id: "databaseviewer",

prefixUrl: "../../Scripts/openseadragon/images/",

tileSources: url,

maxZoomLevel: 20

});

但这并没有改变任何东西。这是我完整的脚本:

var url = '@Model.ImageUrl'; 

var viewer = OpenSeadragon({

crossOrigin: "Anonymous",

id: "databaseviewer",

prefixUrl: "../../Scripts/openseadragon/images/",

tileSources: url,

maxZoomLevel: 20

});

viewer.addHandler('open', function() {

var downloadlink = document.getElementById("download");

$(downloadlink).on("click", function() {

var img = viewer.drawer.canvas.toDataURL("image/png");

downloadlink.href = img;

downloadlink.download = '@Model.DatabaseName';

});

});

回答:

按照API documentation,应该在政策选择重命名为crossOriginPolicy

以上是 无法从污染的画布下载图像;我如何下载托管在Amazon s3存储桶中的Seadragon映像? 的全部内容, 来源链接: utcz.com/qa/259954.html

回到顶部