50 bool $a_constrain_prop =
false 52 if ($a_constrain_prop) {
53 $size =
" -geometry " . $a_width .
"x" . $a_height .
" ";
55 $size =
" -resize " . $a_width .
"x" . $a_height .
"! ";
70 return escapeshellarg($a_arg);
81 if (preg_match(
"/([0-9]+)\.([0-9]+)\.([0-9]+)([\.|\-]([0-9]+))?/", $a_version, $match)) {
82 $version = str_pad($match[1], 2,
"0", STR_PAD_LEFT) .
83 str_pad($match[2], 2,
"0", STR_PAD_LEFT) .
84 str_pad($match[3], 2,
"0", STR_PAD_LEFT) .
85 str_pad($match[5], 2,
"0", STR_PAD_LEFT);
96 if (ini_get(
'safe_mode') == 1) {
104 return escapeshellcmd($a_arg);
114 if (
ilUtil::isWindows() && strpos($cmd,
" ") !==
false && substr($cmd, 0, 1) !==
'"') {
116 $cmd =
'"' . $cmd .
'"';
120 if (version_compare(phpversion(),
"5.2",
"<") && strpos($args,
'"') !==
false) {
121 $cmd =
'"' . $cmd .
" " . $args .
'"';
133 $DIC->logger()->root()->debug(
"ilUtil::execQuoted: " . $cmd .
".");
143 $current_version = self::processConvertVersion($current_version[0]);
144 $version = self::processConvertVersion($a_version);
156 return PATH_TO_CONVERT;
165 string $a_target_format =
"",
166 string $a_geometry =
"",
167 string $a_background_color =
"" 169 $format_str = ($a_target_format !=
"")
170 ? strtoupper($a_target_format) .
":" 173 if ($a_geometry !=
"") {
174 if (is_int(strpos($a_geometry,
"x"))) {
175 $geometry =
" -geometry " . $a_geometry .
" ";
177 $geometry =
" -geometry " . $a_geometry .
"x" . $a_geometry .
" ";
181 $bg_color = ($a_background_color !=
"")
182 ?
" -background color " . $a_background_color .
" " 199 $args = self::escapeShellCmd($args);
static isConvertVersionAtLeast(string $a_version)
static processConvertVersion(string $a_version)
Parse convert version string, e.g.
static escapeShellArg(string $a_arg)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static convertImage(string $a_from, string $a_to, string $a_target_format="", string $a_geometry="", string $a_background_color="")
static execQuoted(string $cmd, ?string $args=null)
static escapeShellCmd(string $a_arg)
static execConvert(string $args)
execute convert command
static resizeImage(string $a_from, string $a_to, int $a_width, int $a_height, bool $a_constrain_prop=false)
resize image