php - Big PDF to JPEG Conversion with ImageMagick returns 500 Internal Error -


my code converts pdf file pages jpeg images once uploaded, , goes fine when working on light pdfs (not many images , effects, while number of pages no more 40-50 on average). when file heavier, "500 internal error". pdf has been uploaded , pages have been converted break point.

my code:

$foldername = str_replace('.','',preg_replace('/\s+/', '', microtime())); mkdir("./mag_thumbs/".$foldername, 0755, true); try {     $compression_type = imagick::compression_jpeg;      $im = new imagick();     $im->setresolution(250,250);     $im->readimage($pdf_path);      $pdf_count = $im->getnumberimages();     $im->setimageformat('jpg');     $im->flattenimages();         $im->setimagecompression($compression_type);      $im->setimagecompressionquality(40);      $im->writeimages('./mag_thumbs/'.$foldername.'/page.jpg',true);      $im->clear();      $im->destroy(); } catch(exception $e){ /* troubleshooting code */ } 

am supposed expand servers' time out? other better solution?

enter these lines above code:

ini_set('max_execution_time', 10000);//you can change limit ini_set("memory_limit", "6400m");//you can change limit 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -