Skip to content

Commit

Permalink
Merge branch 'master' into feature/contrast
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Jan 30, 2018
2 parents 220ce5f + 5795a17 commit 3bf2438
Show file tree
Hide file tree
Showing 12 changed files with 249 additions and 112 deletions.
126 changes: 63 additions & 63 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions package.json
Expand Up @@ -53,15 +53,15 @@
"chai-as-promised": "^7.1.1",
"chokidar": "^2.0.0",
"devtron": "^1.0.0",
"electron": "1.6.15",
"electron": "1.6.16",
"electron-devtools-installer": "^2.2.3",
"electron-mocha": "^5.0.0",
"electron-packager": "^10.1.1",
"electron-winstaller": "^2.6.3",
"electron-winstaller": "^2.6.4",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"eslint": "^4.15.0",
"eslint-plugin-react": "^7.5.1",
"eslint": "^4.16.0",
"eslint-plugin-react": "^7.6.0",
"glob": "^7.0.0",
"istanbul-lib-hook": "^1.1.0",
"istanbul-lib-instrument": "^1.9.1",
Expand All @@ -73,14 +73,14 @@
"react-dnd-test-backend": "^2.5.4",
"react-test-renderer": "^16.2.0",
"sass-lint": "^1.12.1",
"shelljs": "^0.8.0",
"sinon": "^4.1.6",
"shelljs": "^0.8.1",
"sinon": "^4.2.0",
"sinon-chai": "^2.14.0",
"sqleton": "^1.2.4"
},
"dependencies": {
"@pixi/filter-adjustment": "^2.5.0",
"@tweenjs/tween.js": "^17.1.1",
"@tweenjs/tween.js": "^17.2.0",
"bluebird": "^3.5.1",
"classnames": "^2.2.5",
"colors": "^1.1.2",
Expand All @@ -94,17 +94,17 @@
"mkdirp": "^0.5.1",
"ms": "^2.1.1",
"n3": "^0.11.2",
"pixi.js": "^4.6.2",
"pixi.js": "^4.7.0",
"prop-types": "^15.6.0",
"prosemirror-commands": "^1.0.3",
"prosemirror-commands": "^1.0.4",
"prosemirror-gapcursor": "^1.0.0",
"prosemirror-history": "^1.0.0",
"prosemirror-inputrules": "^1.0.1",
"prosemirror-model": "^1.1.0",
"prosemirror-schema-basic": "^1.0.0",
"prosemirror-schema-list": "^1.0.0",
"prosemirror-state": "^1.0.2",
"prosemirror-view": "^1.0.9",
"prosemirror-state": "^1.1.0",
"prosemirror-view": "^1.0.10",
"react": "^16.2.0",
"react-dnd": "^2.5.4",
"react-dnd-electron-backend": "^1.5.1",
Expand Down
13 changes: 9 additions & 4 deletions src/commands/import.js
Expand Up @@ -3,7 +3,7 @@
const { DuplicateError } = require('../common/error')
const { call, put, select } = require('redux-saga/effects')
const { Command } = require('./command')
const { imagePath } = require('../common/cache')
const { imagePath, imageExt } = require('../common/cache')
const mod = require('../models')
const act = require('../actions')
const { warn, verbose } = require('../common/log')
Expand All @@ -14,13 +14,18 @@ class ImportCommand extends Command {
*createThumbnails(id, image, { overwrite = true, quality = 100 } = {}) {
try {
const { cache } = this.options
const ext = imageExt(image.mimetype)

for (let size of [48, 512]) {
const path = imagePath(id, size)
const path = imagePath(id, size, ext)

if (overwrite || !(yield call(cache.exists, path))) {
const thumb = yield call(image.resize, size)
yield call(this.options.cache.save, path, thumb.toJPEG(quality))
const dup = yield call(image.resize, size)
const out = (ext === '.png') ?
dup.toPNG() :
dup.toJPEG(quality)

yield call(this.options.cache.save, path, out)

} else {
verbose(`Skipping ${size}px thumbnail for #${id}: already exists`)
Expand Down

0 comments on commit 3bf2438

Please sign in to comment.