Why use a shell command if you can do this from inside PHP?
Take a look at FPDF (
http://www.fpdf.org/)
This is a PHP library for PDF generation (coded in PHP, no special extension needed).
For your purpose, creating the PDF, putting the image where you want (maybe scale it) and doing the output (to file or directly to browser) should be done in only a few lines.
Regards
ric.