Skip to content

Instantly share code, notes, and snippets.

@tsaiid
Created June 20, 2013 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsaiid/5822520 to your computer and use it in GitHub Desktop.
Save tsaiid/5822520 to your computer and use it in GitHub Desktop.
in safe_mode, exec() will force to use escapeshellcmd(), which will cause problem if pre-added quote.
@@ -472,7 +472,7 @@ function ime_im_cli_check_executable($fullpath) {
if (!is_executable($fullpath))
return false;
- @exec('"' . $fullpath . '" --version', $output);
+ @exec($fullpath . ' --version', $output);
return count($output) > 0;
}
@@ -547,7 +547,7 @@ function ime_im_cli_resize( $old_file, $new_file, $width, $height, $crop, $resiz
$geometry = $width . 'x' . $height;
// limits are 150mb and 128mb
- $cmd = "\"$cmd\" \"$old_file\" -limit memory 157286400 -limit map 134217728 -resize $geometr
+ $cmd = "$cmd $old_file -limit memory 157286400 -limit map 134217728 -resize $geometry";
if ($crop) {
// '^' is an escape character on Windows
$cmd .= (ime_is_windows() ? '^^' : '^') . " -gravity center -extent $geometry";
@@ -561,7 +561,7 @@ function ime_im_cli_resize( $old_file, $new_file, $width, $height, $crop, $resiz
if ( $resize_mode == 'size' )
$cmd .= ' -strip';
- $cmd .= ' "' . $new_file . '"';
+ $cmd .= ' ' . $new_file ;
exec($cmd);
return file_exists($new_file);
@@ -1075,4 +1075,4 @@ function ime_option_page() {
</div>
<?php
}
-?>
\ No newline at end of file
+?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment