Hi,
The code below is to call ImageMagick to convert a PNG file to a PDF file from PHP script:
//*****************************************//
// FIRST_CODE.php3
$font = "arial.ttf";
$txt = "Testing 123";
$png_name = "Test.PNG";
$pdf_name = "Test.PDF";
$run = "/usr/bin/X11/convert -font $font -draw 'text 2400,120 $txt' -pointsize 72 $png_name $pdf_name";
exec("$run");
//*****************************************//
Anyone can tell me why the code above sometime can work BUT sometime cannot? (after i reboot the system - RH7.1)
When i found that the code above cannot work, i have change the $run to this:
//*****************************************//
// SECOND_CODE.php3
$font = "arial.ttf";
$txt = "Testing 123";
$png_name = "Test.PNG";
$pdf_name = "Test.PDF";
$run = "/path-to-imagemagick/convert -font $font -draw 'text 2400,120 $txt' -pointsize 72 $png_name $pdf_name";
exec("$run");
//*****************************************//
and this time it work. UNFORTUNATELY when i reboot the system, it'll (SECOND_CODE.php3) NOT work again BUT the FIRST_CODE.php3 become workable. Why.....?
Thankz.