Created
June 20, 2013 13:11
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -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