Tag: collectionfs

如何使用Meteor,CollectionFS和FFMPEG创buildvideo缩略图

我使用meteor与CollectionFS来存储video。 我需要一个转换来创build我的video缩略图。 Videos = new FS.Collection("videos", { stores: [ new FS.Store.FileSystem("thumbs", { transformWrite: function(fileObj, readStream, writeStream) { // What goes here? } }), new FS.Store.FileSystem("videos"), ], }); 我已经研究出如何使用ffmpeg来做到这一点: ffmpeg -i video.mp4 -vf "thumbnail,scale=640:360" -frames:v 1 thumb.png 但我不知道如何做到这一点与我给的readStream和输出writeStream。 下面是使用GraphicsMagick对图像进行处理的一个例子: Images = new FS.Collection("images", { stores: [ new FS.Store.FileSystem("thumbs", { transformWrite: function(fileObj, readStream, writeStream) { // Transform […]

显示Meteor.js中的对象的FS.File引用

我正在使用CollectionFS来允许图片上传。 图片上传需要属于特定的posts 。 我遵循文档中的步骤 – 在对象中存储FS.File引用 – 但是,我很难显示相关文章的图像。 该post目前保存一个引用image._id的postImage – 这部分工作正常。 但是,我不确定如何显示实际的照片,因为它将需要从images集合中抓取照片( post集合只是将ID保存到引用)。 后list.html <template name="postList"> <tr data-id="{{ _id }}" class="{{ postType }}"> … <td><textarea name="postContent" value="{{ postContent }}"></textarea> </td> <td>{{ postImage._id }} </td> // This currently displays the correct image._id, but I would like to display the image, <td><button class="delete tiny alert">Delete</button></td> </tr> </template> […]

Meteor.JS CollectionFSvideo图像缩略图(graphicsMagick)

我正在使用CollectionFS上传文件的一个Meteor应用程序。 我能够上传并生成图像的缩略图。 但是我的问题是:我应该如何为video创build缩略图? 我可以看到,它可以通过命令行︰https : //superuser.com/questions/599348/can-imagemagick-make-thumbnails-from-video 但是我怎么能把这个应用到我的Meteor代码中。 这是我在做什么: VideoFileCollection = new FS.Collection("VideoFileCollection", { stores: [ new FS.Store.FileSystem("videos", {path: "/uploads/videos"}), new FS.Store.FileSystem("videosthumbs", {path: "/uploads/videosthumbs", beforeWrite: function(fileObj) { // We return an object, which will change the // filename extension and type for this store only. return { extension: 'png', type: 'image/png' }; }, transformWrite: function(fileObj, readStream, […]

如何从CollectionFS获取文件(映像)的缓冲区

我试图插入一个图像到PDF我创buildPDFkit的服务器端。 我正在使用cfs:dropbox来存储我的文件。 在使用cvs:filesystem之前,很容易将这些图像添加到我的pdf中,因为它们就在那里。 现在,他们远程存储,我不知道如何添加它们,因为PDFkit不支持添加图像只有url。 但是,它会接受一个缓冲区。 我怎样才能从我的CollectionFS文件缓冲区? 到目前为止,我有这样的东西: var portrait = Portraits.findOne('vS2yFy4gxXdjTtz5d'); readStream = portrait.createReadStream('portraits'); 到目前为止,我尝试了两种方法: 首先使用dataMan,但最后的命令永远不会回来: var dataMan = new DataMan.ReadStream(readStream, portrait.type()); var buffer = Meteor.wrapAsync(Function.prototype.bind(dataMan.getBuffer, dataMan))(); 其次手动缓冲stream: var buffer = new Buffer(0); readStream.on('readable', function() { buffer = Buffer.concat([buffer, readStream.read()]); }); readStream.on('end', function() { console.log(buffer.toString('base64')); }); 那似乎也不会回来。 我仔细检查了我的文档,确保它在那里,它有一个有效的url,当我把url放在浏览器中时,图片就出现了。 我错过了什么吗?