Socket
Socket
Sign inDemoInstall

@uppy/thumbnail-generator

Package Overview
Dependencies
Maintainers
5
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/thumbnail-generator - npm Package Compare versions

Comparing version 3.0.8 to 3.1.0

src/index.ts

7

CHANGELOG.md
# @uppy/thumbnail-generator
## 3.1.0
Released: 2024-03-27
Included in: Uppy v3.24.0
- @uppy/thumbnail-generator: migrate to TS (Merlijn Vos / #4978)
## 3.0.7

@@ -4,0 +11,0 @@

52

lib/index.js

@@ -5,6 +5,10 @@ import { UIPlugin } from '@uppy/core';

import isPreviewSupported from '@uppy/utils/lib/isPreviewSupported';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore untyped
import { rotation } from 'exifr/dist/mini.esm.mjs';
import locale from './locale.js';
import locale from "./locale.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore We don't want TS to generate types for the package.json
const packageJson = {
"version": "3.0.8"
"version": "3.1.0"
};

@@ -14,4 +18,2 @@ /**

*
* @param {HTMLCanvasElement} canvas
* @returns {Promise}
*/

@@ -95,3 +97,9 @@ function canvasToBlob(canvas, type, quality) {

}
const defaultOptions = {
thumbnailWidth: null,
thumbnailHeight: null,
thumbnailType: 'image/jpeg',
waitForThumbnailsBeforeUpload: false,
lazy: false
};
/**

@@ -103,3 +111,6 @@ * The Thumbnail Generator plugin

constructor(uppy, opts) {
super(uppy, opts);
super(uppy, {
...defaultOptions,
...opts
});
this.onFileAdded = file => {

@@ -177,14 +188,4 @@ if (!file.preview && file.data && isPreviewSupported(file.type) && !file.isRemote) {

this.defaultThumbnailDimension = 200;
this.thumbnailType = this.opts.thumbnailType || 'image/jpeg';
this.thumbnailType = this.opts.thumbnailType;
this.defaultLocale = locale;
const defaultOptions = {
thumbnailWidth: null,
thumbnailHeight: null,
waitForThumbnailsBeforeUpload: false,
lazy: false
};
this.opts = {
...defaultOptions,
...opts
};
this.i18nInit();

@@ -195,11 +196,2 @@ if (this.opts.lazy && this.opts.waitForThumbnailsBeforeUpload) {

}
/**
* Create a thumbnail for the given Uppy file object.
*
* @param {{data: Blob}} file
* @param {number} targetWidth
* @param {number} targetHeight
* @returns {Promise}
*/
createThumbnail(file, targetWidth, targetHeight) {

@@ -237,6 +229,6 @@ const originalUrl = URL.createObjectURL(file.data);

*/
getProportionalDimensions(img, width, height, rotation) {
getProportionalDimensions(img, width, height, deg) {
// eslint-disable-line no-shadow
let aspect = img.width / img.height;
if (rotation === 90 || rotation === 270) {
if (deg === 90 || deg === 270) {
aspect = img.height / img.width;

@@ -300,4 +292,4 @@ }

}
addToQueue(item) {
this.queue.push(item);
addToQueue(fileID) {
this.queue.push(fileID);
if (this.queueProcessing === false) {

@@ -304,0 +296,0 @@ this.processQueue();

{
"name": "@uppy/thumbnail-generator",
"description": "Uppy plugin that generates small previews of images to show on your upload UI.",
"version": "3.0.8",
"version": "3.1.0",
"license": "MIT",

@@ -26,3 +26,3 @@ "main": "lib/index.js",

"dependencies": {
"@uppy/utils": "^5.7.2",
"@uppy/utils": "^5.7.5",
"exifr": "^7.0.0"

@@ -35,4 +35,4 @@ },

"peerDependencies": {
"@uppy/core": "^3.9.1"
"@uppy/core": "^3.10.0"
}
}
import { afterEach, beforeEach, describe, it, expect, vi } from 'vitest'
import { UIPlugin } from '@uppy/core'
import emitter from 'namespace-emitter'
import ThumbnailGeneratorPlugin from './index.js'
import ThumbnailGeneratorPlugin from './index.ts'

@@ -6,0 +6,0 @@ const delay = duration => new Promise(resolve => setTimeout(resolve, duration))

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc