I am running a laravel project in my local ubuntu 20.04 machine that was functioning fine in another machine. The project uses Image Magic to convert PDF to PNG. While I am evoking the function to convert PDF into PNG I get the following error:
ImagickException attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/408
THE function looks:
public function show($id)
{
$book = Book::all()->first();
$file = public_path('' . $book->pdf);
$count = 0;
$im = new \Imagick($file);
$blobList=[];
do {
$page = new \Imagick();
$page->setResolution(300,300);
$page->readImage($file . '['.$count.']');
$page->setImageFormat("jpeg");
header("Content-Type: image/jpeg");
$image = $page->getImageBlob();
array_push($blobList,$image);
$count++;
} while (5> $count);
// $im->resizeImage(200,200,1,0);
return view('notice/showbook', compact('book', 'blobList'));
}
SO far I have installed image magic and gs and made changes in policymap.xml
with reference to the accepted answer of this question
Yet, the error persists. please help!
Thanks,