Convert PDF to JPG image with PHP

imagemagick, jpeg, pdf, php

Solution

Try this.

<?php
    $pdf = 'testfile.pdf';
    $save = 'output.jpg';

    exec('convert "'.$pdf.'" -colorspace RGB -resize 800 "'.$save.'"', $output, $return_var);

?>

Problem

I am using ImageMagik to try and convert the contents of a PDF to JPG, but keep getting an empty jpg. I have made sure the perms are 777 on everything for testing so I am a little lost how to continue. Here is the script I am running ``` <?php exec('convert testfile.pdf output.jpg', $output, $return_var); ?> ```

Original source