如何显示翻译后生成的缩略图 [英] How do I display a thumbnail that has been generated after translation

查看:43
本文介绍了如何显示翻译后生成的缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将文件转换为SVF之后,我可以看到已经生成了缩略图.如何使用URN显示这些缩略图?

After translating a file to SVF I can see that there is thumbnails that have been generated. How do I use the URN to display these thumbnails?

谢谢!

推荐答案

您可以使用Thumbnail端点下载图片,但是需要Token.因此,例如,您可以将其下载到服务器端(带有令牌),然后将流重定向到客户端(从服务器).

You can use the Thumbnail endpoint to download the picture, but it requires the Token. So you can, for instance, download it on your server-side (with the token) and redirect the stream to the client-side (from your server).

这是缩略图端点:'/modelderivative/'+ MD_PROJECT_VERSION +'/designdata/'+缸+'/thumbnail?width = XXX& height = XXX';

Here is the thumbnail endpoint: '/modelderivative/' + MD_PROJECT_VERSION + '/designdata/' + urn + '/thumbnail?width=XXX&height=XXX';

还有一个示例(NodeJS)

And an example (NodeJS)

getThumbnail: function (thumbnailUrn, onsuccess){
    request({
        url: '/modelderivative/v2/designdata/' + thumbnailUrn + '/thumbnail?width=100&height=100';,
        method: "GET",
        headers: {
            'Authorization': 'Bearer ' + token
        },
        encoding: null
    }, function (error, response, body) {
        onsuccess(new Buffer(body, 'base64'));
    });
},

还有一个NodeJS路由器:

And an NodeJS router:

router.get('/thumbnail', function (req, res) {
   getThumbnail(req.query.urn, function (thumb) {
        res.setHeader('Content-type', 'image/png');
        res.end(thumb);
    });
});

最后,您可以使用HTML:

Finally at your HTML you can just use:

<img src="/thumbnail?urn=XxXxXxXxX">

这篇关于如何显示翻译后生成的缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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