Thank you, snibgo. It was a memory problem.
I changed the code to:
$im = new imagick($uploadfile);
$pages = $im->getNumberImages();
if ($pages < 3) { $resolution = 600; } else { $resolution = floor(sqrt(1000000/$pages)); }
$imagick = new imagick();
$imagick->setResolution($resolution, $resolution ...
Search found 2 matches
- 2017-08-17T04:06:50-07:00
- Forum: IMagick
- Topic: Converting a multi-page pdf to multiple JPG images with Imagick and PHP
- Replies: 2
- Views: 15855
- 2017-08-16T11:47:33-07:00
- Forum: IMagick
- Topic: Converting a multi-page pdf to multiple JPG images with Imagick and PHP
- Replies: 2
- Views: 15855
Converting a multi-page pdf to multiple JPG images with Imagick and PHP
I have a small script for creating jpg images from an uploaded multi-paged pdf file ($uploadfile) with Imagick:
$imagick = new imagick();
$imagick->setResolution(600, 600);
$imagick->readImage($uploadfile);
$imagick->setImageFormat('jpg');
$pages = (int)$imagick->getNumberImages();
foreach ...
$imagick = new imagick();
$imagick->setResolution(600, 600);
$imagick->readImage($uploadfile);
$imagick->setImageFormat('jpg');
$pages = (int)$imagick->getNumberImages();
foreach ...