Shell script


<?php
// Run the script
exec("/FULL PATH TO SCRIPT/autotrim.sh input.png output.png 2>&1", $array); 

//Display any errors
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";

/* When I ran the code I recived an error:
/autotrim.sh: line 271: bc: command not found
bc is a calculator that is built into Unix/Linux.
I ran the code below to get some information about the path for bc and it did not return anything so I assumed bc was not installed.
I contacted my hosts who installed it and the code worked OK.
*/
echo "<pre>";
system('which bc',$path);
print_r($path); 
echo "</pre>";

//Alternative method using "back ticks"
`/FULL PATH TO SCRIPT/texteffect.sh -t "Anthony" -s glow -e normal -f verdana.ttf -p 48 -c skyblue -b white -o skyblue -l 1 -m 10 -g blue back_tick.png`; 
?>

Using a shell script with php and IM. Download the script and upload it to your server.
Change the permissions to 755 on the script.
Write your php code like this using the full path to the script.


More information about this snippet