mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-08-10 16:04:11 +02:00
Add gm support for PDF thumbs.
This commit is contained in:
@@ -135,7 +135,7 @@ class Setup {
|
|||||||
$cmd = 'which';
|
$cmd = 'which';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (['avconv', 'convert', 'du', 'ffmpeg', 'tar', 'zip'] as $c) {
|
foreach (['avconv', 'convert', 'du', 'ffmpeg', 'gm', 'tar', 'zip'] as $c) {
|
||||||
$cmds[$c] = ($cmd !== false) && Util::exec_0($cmd . ' ' . $c);
|
$cmds[$c] = ($cmd !== false) && Util::exec_0($cmd . ' ' . $c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,6 +175,7 @@ class Setup {
|
|||||||
'HAS_CMD_CONVERT',
|
'HAS_CMD_CONVERT',
|
||||||
'HAS_CMD_DU',
|
'HAS_CMD_DU',
|
||||||
'HAS_CMD_FFMPEG',
|
'HAS_CMD_FFMPEG',
|
||||||
|
'HAS_CMD_GM',
|
||||||
'HAS_CMD_TAR',
|
'HAS_CMD_TAR',
|
||||||
'HAS_CMD_ZIP'
|
'HAS_CMD_ZIP'
|
||||||
]);
|
]);
|
||||||
|
@@ -5,6 +5,7 @@ class Thumb {
|
|||||||
private static $FFMPEG_CMDV = ['ffmpeg', '-ss', '0:00:10', '-i', '[SRC]', '-an', '-vframes', '1', '[DEST]'];
|
private static $FFMPEG_CMDV = ['ffmpeg', '-ss', '0:00:10', '-i', '[SRC]', '-an', '-vframes', '1', '[DEST]'];
|
||||||
private static $AVCONV_CMDV = ['avconv', '-ss', '0:00:10', '-i', '[SRC]', '-an', '-vframes', '1', '[DEST]'];
|
private static $AVCONV_CMDV = ['avconv', '-ss', '0:00:10', '-i', '[SRC]', '-an', '-vframes', '1', '[DEST]'];
|
||||||
private static $CONVERT_CMDV = ['convert', '-density', '200', '-quality', '100', '-sharpen', '0x1.0', '-strip', '[SRC][0]', '[DEST]'];
|
private static $CONVERT_CMDV = ['convert', '-density', '200', '-quality', '100', '-sharpen', '0x1.0', '-strip', '[SRC][0]', '[DEST]'];
|
||||||
|
private static $GM_CONVERT_CMDV = ['gm', 'convert', '-density', '200', '-quality', '100', '-sharpen', '0x1.0', '[SRC][0]', '[DEST]'];
|
||||||
private static $THUMB_CACHE = 'thumbs';
|
private static $THUMB_CACHE = 'thumbs';
|
||||||
|
|
||||||
private $context;
|
private $context;
|
||||||
@@ -40,8 +41,12 @@ class Thumb {
|
|||||||
} else if ($this->setup->get('HAS_CMD_FFMPEG')) {
|
} else if ($this->setup->get('HAS_CMD_FFMPEG')) {
|
||||||
$capture_path = $this->capture(Thumb::$FFMPEG_CMDV, $source_path);
|
$capture_path = $this->capture(Thumb::$FFMPEG_CMDV, $source_path);
|
||||||
}
|
}
|
||||||
} else if ($type === 'doc' && $this->setup->get('HAS_CMD_CONVERT')) {
|
} else if ($type === 'doc') {
|
||||||
$capture_path = $this->capture(Thumb::$CONVERT_CMDV, $source_path);
|
if ($this->setup->get('HAS_CMD_CONVERT')) {
|
||||||
|
$capture_path = $this->capture(Thumb::$CONVERT_CMDV, $source_path);
|
||||||
|
} else if ($this->setup->get('HAS_CMD_GM')) {
|
||||||
|
$capture_path = $this->capture(Thumb::$GM_CONVERT_CMDV, $source_path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->thumb_href($capture_path, $width, $height);
|
return $this->thumb_href($capture_path, $width, $height);
|
||||||
|
@@ -106,8 +106,8 @@ modulejs.define('main/info', ['$', 'config', 'core/resource', 'core/server'], fu
|
|||||||
);
|
);
|
||||||
|
|
||||||
addTest(
|
addTest(
|
||||||
'PDF thumbs', 'Command line program <code>convert</code> available',
|
'PDF thumbs', 'Command line program <code>convert</code> or <code>gm</code> available',
|
||||||
setup.HAS_CMD_CONVERT
|
setup.HAS_CMD_CONVERT || setup.HAS_CMD_GM
|
||||||
);
|
);
|
||||||
|
|
||||||
addTest(
|
addTest(
|
||||||
|
Reference in New Issue
Block a user