I have a basic php based file uploader script. What I am looking to do is after the file is uploaded if the file that was uploaded is an image mime type then convert it into a pdf
Attached is the code I am using. Also I have Imagemagick and Imagick module installed on my cpanel lunix based vps.
if($thefileext =='jpg' || $thefileext =='png' || $thefileext =='jpeg')
{
echo "the filename is $thefile"; //echoing to make sure if statement works
$img = new Imagick("img/$thefile");
$img->setImageFormat('pdf');
$success = $img->writeImage("img/$thefile");
}
My issue is when I try to upload a .jpg file it gets uploaded fine (so my php uploader script is working) however the above Imagick code does not seem to be working. I am calling it after the actual upload functionality of the script. Any suggestions?