I am trying a run an image magick commands which spans overs two lines for better readability. Will it run OK with PHP exec method? As an example, please have a look at following lines:
exec("convert thumbnail.gif autumn_leaves.png +swap
-gravity center -compose DstOver -composite
border_leaves.gif");
This is how I write my code now for better readability:
$cmd = "thumbnail.gif autumn_leaves.png +swap ".
" -gravity center -compose DstOver -composite ";
exec("convert $cmd border_leaves.gif");
This has an added benifit that if you are using variables in you code you can echo $cmd to view what the actual command is.
Another thought is if you write your code in blocks you can comment out blocks when fault finding to see where the code goes wrong.
Probably not. Instead of putting the new lines actually in the string, you could use concatenation so it looks like multiple lines but the final string is still one line:
exec("convert thumbnail.gif autumn_leaves.png +swap " .
"-gravity center -compose DstOver -composite " .
"border_leaves.gif");