I want to create a thumbnail of a PDF. I am not able to create thumbnail. In raw PHP it works but in Joomla it's not working. Please let me know what I am doing wrong.
$uploadPath = JPATH_ADMINISTRATOR . '/components/com_ets_fast_track/assets/buildings/' . $filename;
$fileTemp = $file['tmp_name'];
if(!JFile::exists($uploadPath)){
//name the thumbnail image the same as the pdf file
$pdfWithPath = $uploadPath;
$thumbDirectory = JPATH_ADMINISTRATOR . '/components/com_ets_fast_track/assets/buildings/';
$thumb = basename($filename, ".pdf");
//add the desired extension to the thumbnail
$thumb = $thumbDirectory.$thumb.".jpg";
//execute imageMagick's 'convert', setting the color space to RGB and size to 200px wide
exec("convert $pdfWithPath[0] $thumb");
}