Adjustments to transcoding to allow psd transcoding to actually work
Changed resize extension to run later in the extension stack Little fixes
This commit is contained in:
parent
3269d32378
commit
1aa0225652
@ -201,12 +201,13 @@ function create_thumbnail_convert($hash): bool
|
|||||||
$options .= "\>";
|
$options .= "\>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$bg = "black";
|
||||||
if($type=="webp") {
|
if($type=="webp") {
|
||||||
$format = '"%s" -thumbnail %ux%u%s -quality %u -background none "%s[0]" %s:"%s"';
|
$bg = "none";
|
||||||
} else {
|
|
||||||
$format = '"%s" -flatten -strip -thumbnail %ux%u%s -quality %u "%s[0]" %s:"%s"';
|
|
||||||
}
|
}
|
||||||
$cmd = sprintf($format, $convert, $w, $h, $options, $q, $inname, $type, $outname);
|
$format = '"%s" -flatten -strip -thumbnail %ux%u%s -quality %u -background %s "%s[0]" %s:"%s"';
|
||||||
|
|
||||||
|
$cmd = sprintf($format, $convert, $w, $h, $options, $q, $bg, $inname, $type, $outname);
|
||||||
$cmd = str_replace("\"convert\"", "convert", $cmd); // quotes are only needed if the path to convert contains a space; some other times, quotes break things, see github bug #27
|
$cmd = str_replace("\"convert\"", "convert", $cmd); // quotes are only needed if the path to convert contains a space; some other times, quotes break things, see github bug #27
|
||||||
exec($cmd, $output, $ret);
|
exec($cmd, $output, $ret);
|
||||||
|
|
||||||
|
@ -265,7 +265,8 @@ const MIME_TYPE_MAP = [
|
|||||||
'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
|
'avi' => 'video/x-msvideo', 'mpg' => 'video/mpeg', 'mpeg' => 'video/mpeg',
|
||||||
'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php',
|
'mov' => 'video/quicktime', 'flv' => 'video/x-flv', 'php' => 'text/x-php',
|
||||||
'mp4' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm',
|
'mp4' => 'video/mp4', 'ogv' => 'video/ogg', 'webm' => 'video/webm',
|
||||||
'webp' => 'image/webp', 'bmp' =>'image/x-ms-bmp'
|
'webp' => 'image/webp', 'bmp' =>'image/x-ms-bmp', 'psd' => 'image/vnd.adobe.photoshop',
|
||||||
|
'mkv' => 'video/x-matroska'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +16,15 @@
|
|||||||
*/
|
*/
|
||||||
class ResizeImage extends Extension
|
class ResizeImage extends Extension
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Needs to be after the data processing extensions
|
||||||
|
*/
|
||||||
|
public function get_priority(): int
|
||||||
|
{
|
||||||
|
return 55;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function onInitExt(InitExtEvent $event)
|
public function onInitExt(InitExtEvent $event)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
@ -87,7 +87,7 @@ class TranscodeImage extends Extension
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Need to be after upload, but before the processing extensions
|
* Needs to be after upload, but before the processing extensions
|
||||||
*/
|
*/
|
||||||
public function get_priority(): int
|
public function get_priority(): int
|
||||||
{
|
{
|
||||||
@ -424,20 +424,20 @@ class TranscodeImage extends Extension
|
|||||||
}
|
}
|
||||||
$ext = $this->determine_ext($target_format);
|
$ext = $this->determine_ext($target_format);
|
||||||
|
|
||||||
$args = "-flatten";
|
$args = " -flatten ";
|
||||||
$bg = "none";
|
$bg = "none";
|
||||||
switch($target_format) {
|
switch($target_format) {
|
||||||
case "webp-lossless":
|
case "webp-lossless":
|
||||||
$args = '-define webp:lossless=true';
|
$args .= '-define webp:lossless=true';
|
||||||
break;
|
break;
|
||||||
case "webp-lossy":
|
case "webp-lossy":
|
||||||
$args = '';
|
$args .= '';
|
||||||
break;
|
break;
|
||||||
case "png":
|
case "png":
|
||||||
$args = '-define png:compression-level=9';
|
$args .= '-define png:compression-level=9';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$bg = "white";
|
$bg = "black";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$tmp_name = tempnam("/tmp", "shimmie_transcode");
|
$tmp_name = tempnam("/tmp", "shimmie_transcode");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user