From 1021938611e81caccb44d28029fa73a82680a7d4 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Fri, 23 Oct 2009 21:37:42 +0000 Subject: Allow giving custom command line options to ImageMagick with it::imageconvert() --- it.class | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/it.class b/it.class index fdc2fc0..f5a8978 100644 --- a/it.class +++ b/it.class @@ -499,6 +499,7 @@ function _exec_quotevalue($value) * @param $p['size'] Width x height of resulting image, e.g. "160x60" * @param $p['type'] Output file type, e.g. "jpg" * @param $p['types'] Comma separated list of accepted input types, default "gif,jpg,png,bmp,tif,jp2,svg" + * @param $p['-opts'] Custom command line options to ImageMagick convert * @return Success of convert as true/false */ function imageconvert($p) @@ -519,9 +520,10 @@ function imageconvert($p) } $p += array('type' => $type, 'types' => "gif,jpg,png,bmp,tif,jp2,svg"); + $p['-opts'] = array('-thumbnail' => $p['size']) + (array)$p['-opts']; if (it::match(",$type,", ",{$p['types']},")) # Valid type? - $result = it::exec("convert 2>&1 -flatten -quality 75 {-opts} {in} {type}:{out}", array('-opts' => array('-thumbnail' => $p['size'])), $p) === ""; + $result = it::exec("convert 2>&1 -flatten -quality 75 {-opts} {in} {type}:{out}", $p) === ""; return $result; } -- cgit v1.2.3