php imagick convert pdf to jpg not working : please i need help on this ASAP, i've been on it for the past 3days now. i installed imagick and ghostscript on my windows OS. i want to convert a pdf file to an image. The imagick is installed and displaying in the phpinfo but the pdf won't be converted to an image. 
i've tried using the 'magick' keyword instead of convert.
i also installed legacy utilities and used the 'convert' function all to no avail.

here are my xampp and pc specs
arch: x86, vc14, ts enabled, win. 8, gswin32

    ` if(move_uploaded_file($_FILES['pdf']['tmp_name'], $pdfDirectory.$filename)) {
                 
                //the path to the PDF file
                $pdfWithPath = $pdfDirectory.$filename;
                 
                //add the desired extension to the thumbnail
                $thumb = $thumb.".jpg";
                 
                //execute imageMagick's 'convert', setting the color space to RGB and size to 200px wide
                exec("convert \"{$pdfWithPath}[0]\" -colorspace RGB -geometry 100 $thumbDirectory$thumb");
                     
                //show the image
                $thumbnail =  "<p><a href=\"$pdfWithPath\"><img src=\"pdfimage/$thumb\" alt=\"\" /></a></p>";
                $filename1 =  "<p><a href=\"$pdfWithPath\"> FILE </a></p>";
                //echo "$thumbnail";
                //echo "$filename";
                }
                $query = "INSERT INTO files (thumb, department,  title, author, publisher, date_published,  isbn) VALUES ('$thumbnail' , '$dept',  '$filename', '$author', '$publisher', '$datepublished',  '$isbn')";
                $run = mysqli_query($conn, $query);`

 