Use a better way to exec which command

This commit is contained in:
FusionPBX 2022-04-23 17:59:56 -06:00 committed by GitHub
parent 5fd2ca9105
commit 2253f2c17c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 8 deletions

View File

@ -317,15 +317,14 @@ if (!function_exists('fax_split_dtmf')) {
chdir($dir_fax_temp);
//convert pdf to tif
$gs = exec('which gs');
$cmd = $gs . "-q -r".$gs_r." -g".$gs_g." -dBATCH -dPDFFitPage -dNOSAFER -dNOPAUSE -dBATCH -sOutputFile=".correct_path($fax_name).".tif -sDEVICE=tiffg4 -Ilib stocht.ps -c \"{ .75 gt { 1 } { 0 } ifelse} settransfer\" -- ".correct_path($fax_name).".pdf -c quit";
$cmd = exec('which gs')." -q -r".$gs_r." -g".$gs_g." -dBATCH -dPDFFitPage -dNOSAFER -dNOPAUSE -dBATCH -sOutputFile=".correct_path($fax_name).".tif -sDEVICE=tiffg4 -Ilib stocht.ps -c \"{ .75 gt { 1 } { 0 } ifelse} settransfer\" -- ".correct_path($fax_name).".pdf -c quit";
// echo($cmd . "<br/>\n");
exec($cmd);
@unlink($dir_fax_temp.'/'.$fax_name.'.pdf');
}
$tiffinfo = exec('which tiffinfo');
$cmd = "tiffinfo ".correct_path($dir_fax_temp.'/'.$fax_name).".tif | grep \"Page Number\" | grep -c \"P\"";
//get the page count
$cmd = exec('which tiffinfo')." ".correct_path($dir_fax_temp.'/'.$fax_name).".tif | grep \"Page Number\" | grep -c \"P\"";
// echo($cmd . "<br/>\n");
$tif_page_count = exec($cmd);
if ($tif_page_count != '') {
@ -569,8 +568,7 @@ if (!function_exists('fax_split_dtmf')) {
//combine tif files into single multi-page tif
if (is_array($tif_files) && sizeof($tif_files) > 0) {
$tiffcp = exec('which tiffcp');
$cmd = $tiffcp. " -c none ";
$cmd = exec('which tiffcp')." -c none ";
foreach ($tif_files as $tif_file) {
$cmd .= correct_path($tif_file) . ' ';
}
@ -583,8 +581,7 @@ if (!function_exists('fax_split_dtmf')) {
}
//generate pdf from tif
$tiff2pdf = exec('which tiff2pdf');
$cmd = $tiff2pdf . ' -u i -p '.$fax_page_size.
$cmd = exec('which tiff2pdf').' -u i -p '.$fax_page_size.
' -w '.$page_width.
' -l '.$page_height.
' -f -o '.