Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
35
gaia/apps/camera/js/lib/create-thumbnail-image.js
Executable file
35
gaia/apps/camera/js/lib/create-thumbnail-image.js
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
define(function(require, exports, module) {
|
||||
'use strict';
|
||||
|
||||
var cropResizeRotate = require('cropResizeRotate');
|
||||
|
||||
/**
|
||||
* Create a thumbnail size canvas,
|
||||
* copy the <img> or <video> into it
|
||||
* cropping the edges as needed to
|
||||
* make it fit, and then extract the
|
||||
* thumbnail image as a blob and pass
|
||||
* it to the callback.
|
||||
*
|
||||
* @param {Blob} imageBlob [description]
|
||||
* @param {Object} metadata [description]
|
||||
* @param {Object} thumbnailSize [description]
|
||||
* @param {Function} done [description]
|
||||
*/
|
||||
module.exports = function(imageBlob, metadata, thumbnailSize, done) {
|
||||
cropResizeRotate(imageBlob, null, thumbnailSize, null, metadata,
|
||||
function(error, resizedBlob) {
|
||||
|
||||
// If we couldn't resize or rotate it, use the original
|
||||
if (error) {
|
||||
console.error('Error while resizing image: ' + error);
|
||||
done(imageBlob);
|
||||
return;
|
||||
}
|
||||
|
||||
done(resizedBlob);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue