我正在尝试使用imagemagick并排加入两张图片。
$in_file1 = escapeshellarg(trim($dir."_thumb/demo-".($r).".jpg"));
$in_file2 = escapeshellarg(trim($dir."_thumb/demo-".($r+1).".jpg"));
$out_put_file = escapeshellarg(trim($dir."_thumb/demo-horiz-".($i).".jpg"));
//echo "convert $in_file1 $in_file2 +append $out_put_file<hr/>";
//$cmd = "convert ".$in_file1." ". $in_file2. " +append ".$out_put_file;
//echo $cmd."<br/><hr/>";
//exec("convert julycacae_thumb/demo-13.jpg julycacae_thumb/demo-14.jpg +append julycacae_thumb/demo-horiz-6.jpg");
$fmt="convert %s %s +append %s";
$cmd=sprintf($fmt, $in_file1, $in_file2, $out_put_file);
echo $cmd."<br/><hr/>";
exec($cmd, $dimm_loc, $ipmiretval);
syslog(LOG_DEBUG, "Running: $cmd");
if ($ipmiretval > 0) {
syslog(LOG_ERR, "exec FAILED: $cmd");
} else {
syslog(LOG_DEBUG, "exec: $cmd");
}
exec("convert julycdaad_thumb/demo-15.jpg julycdaad_thumb/demo-16.jpg +append julycdaad_thumb/demo-horiz-7.jpg");
$r = $r+2;'
当我在exec中编写完整的图像路径时,它可以正常工作,但是在传递变量时它会有效...