To replicate make a 10200x13200 gray square in sketch (or your app of choice) and export to PDF. The file will be small (<10kb) but IMagick can't load it in a reasonable amount of time.
Here's the code I used to test:
I timeout while processing the first line. I'm looking for a work around that would let me get the resolution of the PDF before I try to open it so I can prevent a PHP timeout. The PDFs I'm processing are uploaded by end-users. I restrict file size (3MB in this case), page size (8.5" x 11"), and page count (1). I get the file size from the POST, but page size and count I'm getting with IMagick.
Code: Select all
$im = new \imagick('/path/to/file.pdf'); $properties = $im->identifyImage();
The problem being that a high resolution low file size PDF will simply timeout. Does anyone know of a solution for this?