最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Angular - Generate thumbnails for uploaded imagevideo - Stack Overflow

programmeradmin1浏览0评论

I have an Angular application where a user can upload files. I want to generate a thumbnail image for files that are images/videos. Basically, all I have is the file bytes and type, I do not save the file in the app, I just forward it to another API. I don't want to save the generated thumbnail locally, I just want to forward it along with the original image/video.

I've found the package simple-thumbnail but I see that it requires either the file path (which I don't have since I do not save the file in my app) or the image URL (which also I don't have since the user upload the image from his puter). Also, this library saves the file, which I don't want.

Is there any way to generate an image thumbnail out of image/video bytes, only to forward it further along with the original file?

I have an Angular application where a user can upload files. I want to generate a thumbnail image for files that are images/videos. Basically, all I have is the file bytes and type, I do not save the file in the app, I just forward it to another API. I don't want to save the generated thumbnail locally, I just want to forward it along with the original image/video.

I've found the package simple-thumbnail but I see that it requires either the file path (which I don't have since I do not save the file in my app) or the image URL (which also I don't have since the user upload the image from his puter). Also, this library saves the file, which I don't want.

Is there any way to generate an image thumbnail out of image/video bytes, only to forward it further along with the original file?

Share Improve this question asked May 20, 2022 at 9:10 Radu HrihoreanuRadu Hrihoreanu 3843 silver badges17 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 4

You can try to create a video element and set your video to it. After loading the video inside the element a canvas can be used to extract an image from that video. This might be useful https://stackoverflow./a/63474748/10143503

发布评论

评论列表(0)

  1. 暂无评论