Ability to rename a file before uploading it to the server

This commit is contained in:
yflory
2017-11-16 18:11:13 +01:00
parent 2813b7219e
commit 25d3d321da
4 changed files with 52 additions and 17 deletions

View File

@@ -105,6 +105,7 @@ define([
var ctx = c2.getContext('2d');
ctx.drawImage(canvas, D.x, D.y, D.w, D.h);
cb(void 0, c2.toDataURL());
};
@@ -124,19 +125,18 @@ define([
Thumb.fromVideoBlob = function (blob, cb) {
var url = URL.createObjectURL(blob);
var video = document.createElement("VIDEO");
video.src = url;
video.addEventListener('loadedmetadata', function() {
video.currentTime = Number(Math.floor(Math.min(video.duration/10, 5)));
video.addEventListener('loadeddata', function() {
var D = getResizedDimensions(video, 'video');
Thumb.fromCanvas(video, D, cb);
});
video.currentTime = Number(Math.floor(Math.min(video.duration/10, 5)));
});
video.addEventListener('error', function (e) {
console.error(e);
cb('ERROR');
});
video.src = url;
};
Thumb.fromPdfBlob = function (blob, cb) {
require.config({paths: {'pdfjs-dist': '/common/pdfjs'}});