对多个输入流使用php proc_open()。防止挂起
似乎在使用proc_open()php函数时,我在使用通过管道传输到进程的流时遇到了问题 我现在开始的过程就是使用convert ImageMagick实用程序将3个图像叠加在一起。当仅使用1个输入流(STDIN)并将一个变量转储到该流中时,转换程序工作正常并返回其输出,该输出可存储在变量中,如下所示:对多个输入流使用php proc_open()。防止挂起,php,stream,io,imagemagick,proc-open,Php,Stream,Io,Imagemagick,Proc Open,似乎在使用proc_open()php函数时,我在使用通过管道传输到进程的流时遇到了问题 我现在开始的过程就是使用convert ImageMagick实用程序将3个图像叠加在一起。当仅使用1个输入流(STDIN)并将一个变量转储到该流中时,转换程序工作正常并返回其输出,该输出可存储在变量中,如下所示: $cmd = BIN_PATH.DIRECTORY_SEPARATOR.'convert '; $cmd .= ' -size SOMESIZE '; $cmd .= ' -background
$cmd = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$cmd .= ' -size SOMESIZE ';
$cmd .= ' -background black ';
$cmd .= ' -fill white ';
$cmd .= ' -stroke none ';
$cmd .= ' -gravity center ';
$cmd .= ' -trim ';
$cmd .= ' -interline-spacing SOMELINEHEIGHT ';
$cmd .= ' -font SOMEFONT ';
$cmd .= ' label:"SOMETEXT" ';
$cmd .= ' miff:- ';
$ctext_opacity = shell_exec($cmd);
首先,我运行convert并将输出存储在$ctext\u opacity变量中。然后通过proc_open()调用下一个命令,$ctext_opacity变量通过STDIN管道传输,并用作输入图像:
$cmd = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$cmd .= '-size SOMESIZE ';
$cmd .= ' xc:\'rgb(230, 225, 50)\' ';
$cmd .= ' -gravity center ';
$cmd .= ' - '; // ImageMagick uses dash(-) for STDIN
$cmd .= ' -alpha Off ';
$cmd .= ' -compose CopyOpacity ';
$cmd .= ' -composite ';
$cmd .= ' -trim ';
$cmd .= ' miff:- ';
$chighlight = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($cmd, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$chighlight .= fgets($pipes[1]); // HERE WE FEED THE OUTPUT OF "CONVERT" TO $chighlight
}
//echo $chighlight; die();
fclose($pipes[1]);
$return_value = proc_close($process);
}
上述命令被调用3次,生成3个单独的图像并存储在3个变量中。下一个命令应该接受这3个变量作为输入图像(ImageMagic语法指定可选io流,如fd:N,其中N是我通过proc_open()生成的流的数目)。然而,我似乎在错误地向输入流写入数据或从标准输出读取数据,这很可能导致进程的输出未刷新,从而导致进程挂起而不终止
$cmd = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$cmd .= ' -size SOMESIZE ';
$cmd .= ' xc:transparent ';
$cmd .= ' -gravity center ';
$cmd .= ' - -geometry -2-2 -composite ';
$cmd .= ' fd:3 -geometry +2+2 -composite ';
$cmd .= ' fd:4 -composite ';
$cmd .= 'png:- ';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "a"),
3 => array("pipe", "r"),
4 => array("pipe", "r")
);
$process = proc_open($cmd, $descriptorspec, $pipes);
if (is_resource($process)) {
$read = null;
$rd = array($pipes[1]);
$write = array($pipes[0], $pipes[3], $pipes[4]);
$wt = array($pipes[0], $pipes[3], $pipes[4]);
$im_args = array($cshade, $chighlight, $ctext);
$except = null;
$readTimeout = 1;
$ctext_deboss = '';
$numchanged = stream_select($read, $write, $except, $readTimeout);
foreach($write as $w) {
$key = array_search($w, $wt);
fwrite($wt[$key], $im_args[$key]);
fclose($wt[$key]);
$read = array($pipes[1]);
$rd = array($pipes[1]);
$write = null;
$except = null;
$readTimeout = 1;
$ctext_deboss = '';
$numchanged = stream_select($read, $write, $except, $readTimeout);
foreach($read as $r) {
while (!feof($r)) {
$ctext_deboss .= fgets($pipes[1]);
}
}
fclose($pipes[1]);
$return_value = proc_close($process);
echo $ctext_deboss; die();
}
}
我似乎无法传输3&4管道的内容,因为convert会抛出一个空/不正确数据的错误解决方案是将3个生成的图像连接到一个php变量中。 因此,每个图像输出都连接到下一个图像。稍后,当调用proc_open()时,为转换输入流(将保存输入文件数据,即我们的连接图像变量)仅分配STDIN。我使用的格式是png,它似乎可以很好地处理这样的堆叠图像。每次提供png:-在用于输入的convert命令中,下一个图像将被提取并用作输入。这样,您就可以从单个变量中为所有3个图像提供图像数据 该解决方案只是编号为fd:N的文件描述符的一种替代方案,该文件描述符在Imagemagick中记录在案。它确实完成了任务,但问题是为什么我用proc_open()设置并提供给Imagemagick convert的额外输入管道不起作用
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(230, 225, 50)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$chighlight = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$chighlight .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
徖
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:'.$fontColor.' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
if($_GET['ctr']==='3') {
$khh .= ' png:- ';
} else {
$khh .= ' png:- ';
}
$ctext = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(50, 85, 20)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$cshade = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$cshade .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$sizeX.'x'.$sizeY;
$khh .= ' xc:transparent ';
$khh .= ' -gravity center ';
$khh .= ' png:- -geometry -'.$i.'-'.$i.' -composite ';
$khh .= ' png:- -geometry +'.$i.'+'.$i.' -composite ';
$khh .= ' png:- -composite ';
$khh .= ' png:- ';
$ctext_deboss = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $cshade.$chighlight.$ctext);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext_deboss .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
徖
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:'.$fontColor.' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
if($_GET['ctr']==='3') {
$khh .= ' png:- ';
} else {
$khh .= ' png:- ';
}
$ctext = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(50, 85, 20)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$cshade = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$cshade .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$sizeX.'x'.$sizeY;
$khh .= ' xc:transparent ';
$khh .= ' -gravity center ';
$khh .= ' png:- -geometry -'.$i.'-'.$i.' -composite ';
$khh .= ' png:- -geometry +'.$i.'+'.$i.' -composite ';
$khh .= ' png:- -composite ';
$khh .= ' png:- ';
$ctext_deboss = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $cshade.$chighlight.$ctext);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext_deboss .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
徖
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:'.$fontColor.' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
if($_GET['ctr']==='3') {
$khh .= ' png:- ';
} else {
$khh .= ' png:- ';
}
$ctext = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(50, 85, 20)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$cshade = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$cshade .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$sizeX.'x'.$sizeY;
$khh .= ' xc:transparent ';
$khh .= ' -gravity center ';
$khh .= ' png:- -geometry -'.$i.'-'.$i.' -composite ';
$khh .= ' png:- -geometry +'.$i.'+'.$i.' -composite ';
$khh .= ' png:- -composite ';
$khh .= ' png:- ';
$ctext_deboss = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $cshade.$chighlight.$ctext);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext_deboss .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
我确定的解决方案是将3个生成的图像连接到一个php变量中。
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:'.$fontColor.' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
if($_GET['ctr']==='3') {
$khh .= ' png:- ';
} else {
$khh .= ' png:- ';
}
$ctext = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(50, 85, 20)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$cshade = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$cshade .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$sizeX.'x'.$sizeY;
$khh .= ' xc:transparent ';
$khh .= ' -gravity center ';
$khh .= ' png:- -geometry -'.$i.'-'.$i.' -composite ';
$khh .= ' png:- -geometry +'.$i.'+'.$i.' -composite ';
$khh .= ' png:- -composite ';
$khh .= ' png:- ';
$ctext_deboss = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $cshade.$chighlight.$ctext);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext_deboss .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
因此,每个图像输出都连接到下一个图像。稍后,当调用proc_open()时,为转换输入流(将保存输入文件数据,即我们的连接图像变量)仅分配STDIN。我使用的格式是png,它似乎可以很好地处理这样的堆叠图像。每次提供png:-在用于输入的convert命令中,下一个图像将被提取并用作输入。这样,您就可以从单个变量中为所有3个图像提供图像数据
该解决方案只是编号为fd:N的文件描述符的一种替代方案,该文件描述符在Imagemagick中记录在案。它确实完成了任务,但问题是为什么我用proc_open()设置并提供给Imagemagick convert的额外输入管道不起作用
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(230, 225, 50)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$chighlight = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$chighlight .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
徖
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:'.$fontColor.' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
if($_GET['ctr']==='3') {
$khh .= ' png:- ';
} else {
$khh .= ' png:- ';
}
$ctext = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(50, 85, 20)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$cshade = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$cshade .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$sizeX.'x'.$sizeY;
$khh .= ' xc:transparent ';
$khh .= ' -gravity center ';
$khh .= ' png:- -geometry -'.$i.'-'.$i.' -composite ';
$khh .= ' png:- -geometry +'.$i.'+'.$i.' -composite ';
$khh .= ' png:- -composite ';
$khh .= ' png:- ';
$ctext_deboss = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $cshade.$chighlight.$ctext);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext_deboss .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
徖
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:'.$fontColor.' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
if($_GET['ctr']==='3') {
$khh .= ' png:- ';
} else {
$khh .= ' png:- ';
}
$ctext = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(50, 85, 20)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$cshade = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$cshade .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$sizeX.'x'.$sizeY;
$khh .= ' xc:transparent ';
$khh .= ' -gravity center ';
$khh .= ' png:- -geometry -'.$i.'-'.$i.' -composite ';
$khh .= ' png:- -geometry +'.$i.'+'.$i.' -composite ';
$khh .= ' png:- -composite ';
$khh .= ' png:- ';
$ctext_deboss = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $cshade.$chighlight.$ctext);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext_deboss .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
徖
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:'.$fontColor.' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
if($_GET['ctr']==='3') {
$khh .= ' png:- ';
} else {
$khh .= ' png:- ';
}
$ctext = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(50, 85, 20)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$cshade = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$cshade .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$sizeX.'x'.$sizeY;
$khh .= ' xc:transparent ';
$khh .= ' -gravity center ';
$khh .= ' png:- -geometry -'.$i.'-'.$i.' -composite ';
$khh .= ' png:- -geometry +'.$i.'+'.$i.' -composite ';
$khh .= ' png:- -composite ';
$khh .= ' png:- ';
$ctext_deboss = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $cshade.$chighlight.$ctext);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext_deboss .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
徖
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:'.$fontColor.' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
if($_GET['ctr']==='3') {
$khh .= ' png:- ';
} else {
$khh .= ' png:- ';
}
$ctext = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$imageSize.' ';
$khh .= ' xc:\'rgb(50, 85, 20)\' ';
$khh .= ' -gravity center ';
$khh .= ' - ';
$khh .= ' -alpha Off ';
$khh .= ' -compose CopyOpacity ';
$khh .= ' -composite ';
$khh .= ' -trim ';
$khh .= ' png:- ';
$cshade = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $ctext_opacity);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$cshade .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}
$khh = BIN_PATH.DIRECTORY_SEPARATOR.'convert ';
$khh .= ' -size '.$sizeX.'x'.$sizeY;
$khh .= ' xc:transparent ';
$khh .= ' -gravity center ';
$khh .= ' png:- -geometry -'.$i.'-'.$i.' -composite ';
$khh .= ' png:- -geometry +'.$i.'+'.$i.' -composite ';
$khh .= ' png:- -composite ';
$khh .= ' png:- ';
$ctext_deboss = '';
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w")
);
$process = proc_open($khh, $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $cshade.$chighlight.$ctext);
fclose($pipes[0]);
while (!feof($pipes[1])) {
$ctext_deboss .= fgets($pipes[1]);
}
fclose($pipes[1]);
$return_value = proc_close($process);
}