mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 09:23:09 +02:00
Use ImageMagick instead of GraphicsMagick
This commit is contained in:
parent
c420901c24
commit
37edacce44
5 changed files with 14 additions and 5 deletions
|
@ -53,7 +53,7 @@ Please install and setup these softwares:
|
||||||
* *Node.js* and *npm*
|
* *Node.js* and *npm*
|
||||||
* **[MongoDB](https://www.mongodb.com/)**
|
* **[MongoDB](https://www.mongodb.com/)**
|
||||||
* **[Redis](https://redis.io/)**
|
* **[Redis](https://redis.io/)**
|
||||||
* **[GraphicsMagick](http://www.graphicsmagick.org/)**
|
* **[ImageMagick](http://www.imagemagick.org/script/index.php)**
|
||||||
|
|
||||||
##### Optional
|
##### Optional
|
||||||
* [Elasticsearch](https://www.elastic.co/) - used to provide searching feature instead of MongoDB
|
* [Elasticsearch](https://www.elastic.co/) - used to provide searching feature instead of MongoDB
|
||||||
|
|
|
@ -54,7 +54,7 @@ web-push generate-vapid-keys
|
||||||
* *Node.js* と *npm*
|
* *Node.js* と *npm*
|
||||||
* **[MongoDB](https://www.mongodb.com/)**
|
* **[MongoDB](https://www.mongodb.com/)**
|
||||||
* **[Redis](https://redis.io/)**
|
* **[Redis](https://redis.io/)**
|
||||||
* **[GraphicsMagick](http://www.graphicsmagick.org/)**
|
* **[ImageMagick](http://www.imagemagick.org/script/index.php)**
|
||||||
|
|
||||||
##### オプション
|
##### オプション
|
||||||
* [Elasticsearch](https://www.elastic.co/) - 検索機能を向上させるために用います。
|
* [Elasticsearch](https://www.elastic.co/) - 検索機能を向上させるために用います。
|
||||||
|
|
|
@ -5,7 +5,7 @@ import * as stream from 'stream';
|
||||||
|
|
||||||
import * as mongodb from 'mongodb';
|
import * as mongodb from 'mongodb';
|
||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import * as gm from 'gm';
|
import * as _gm from 'gm';
|
||||||
import * as debug from 'debug';
|
import * as debug from 'debug';
|
||||||
import fileType = require('file-type');
|
import fileType = require('file-type');
|
||||||
import prominence = require('prominence');
|
import prominence = require('prominence');
|
||||||
|
@ -16,6 +16,10 @@ import serialize from '../serializers/drive-file';
|
||||||
import event, { publishDriveStream } from '../event';
|
import event, { publishDriveStream } from '../event';
|
||||||
import config from '../../conf';
|
import config from '../../conf';
|
||||||
|
|
||||||
|
const gm = _gm.subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
|
||||||
const log = debug('misskey:register-drive-file');
|
const log = debug('misskey:register-drive-file');
|
||||||
|
|
||||||
const tmpFile = (): Promise<string> => new Promise((resolve, reject) => {
|
const tmpFile = (): Promise<string> => new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -7,11 +7,15 @@ import * as express from 'express';
|
||||||
import * as bodyParser from 'body-parser';
|
import * as bodyParser from 'body-parser';
|
||||||
import * as cors from 'cors';
|
import * as cors from 'cors';
|
||||||
import * as mongodb from 'mongodb';
|
import * as mongodb from 'mongodb';
|
||||||
import * as gm from 'gm';
|
import * as _gm from 'gm';
|
||||||
import * as stream from 'stream';
|
import * as stream from 'stream';
|
||||||
|
|
||||||
import DriveFile, { getGridFSBucket } from '../api/models/drive-file';
|
import DriveFile, { getGridFSBucket } from '../api/models/drive-file';
|
||||||
|
|
||||||
|
const gm = _gm.subClass({
|
||||||
|
imageMagick: true
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init app
|
* Init app
|
||||||
*/
|
*/
|
||||||
|
@ -78,6 +82,7 @@ function thumbnail(data: stream.Readable, type: string, resize: number): ISend {
|
||||||
const stream = g
|
const stream = g
|
||||||
.compress('jpeg')
|
.compress('jpeg')
|
||||||
.quality(80)
|
.quality(80)
|
||||||
|
.noProfile() // Remove EXIF
|
||||||
.stream();
|
.stream();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -11,7 +11,7 @@ export default class {
|
||||||
public showAll(): void {
|
public showAll(): void {
|
||||||
this.show('MongoDB', 'mongo --version', x => x.match(/^MongoDB shell version:? (.*)\r?\n/));
|
this.show('MongoDB', 'mongo --version', x => x.match(/^MongoDB shell version:? (.*)\r?\n/));
|
||||||
this.show('Redis', 'redis-server --version', x => x.match(/v=([0-9\.]*)/));
|
this.show('Redis', 'redis-server --version', x => x.match(/v=([0-9\.]*)/));
|
||||||
this.show('GraphicsMagick', 'gm -version', x => x.match(/^GraphicsMagick ([0-9\.]*) .*/));
|
this.show('ImageMagick', 'magick -version', x => x.match(/^Version: ImageMagick (.+?)\r?\n/));
|
||||||
}
|
}
|
||||||
|
|
||||||
public show(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void {
|
public show(serviceName: string, command: string, transform: (x: string) => RegExpMatchArray): void {
|
||||||
|
|
Loading…
Reference in a new issue