If i upload a pdf file with more than 1 page it will show the last page. What should i change in coding to show only the first page?
Here is the code i using to convert.
$impdf = new imagick( DATA_SERVER_PATH."/uploads/".$this->uploadFileDirectory.$itemID."/".$_POST['main_file'] )';
$impdf->setImageFormat('jpeg');
$impdf->writeImage(DATA_SERVER_PATH."/uploads/".$this->uploadFileDirectory.$itemID."/preview.jpg");
Thanks
Add [0] at the end of your filename, [0] is the pagenumber, so [4] will use page 5.
More readable example: