I’ve managed to get it to work, someetimes if it’s a large Pdf it has difficulty.
I called GS directly:
$quality=60; $res='72'; set_time_limit(900); $image = exec("'gs' '-dNOPAUSE' '-dFirstPage=1' '-sDEVICE=jpeg' '-dUseCIEColor' '-dTextAlphaBits=4' '-dGraphicsAlphaBits=4' '-o$dest' '-r$res' '-dJPEGQ=$quality' '$source'",$output);
Many thanks Shaon – when is the next update due for?
So really going around the houses here – I’ve found out that imageMagik is only available via the command line using the exec(); function. I’m going to have a go at re-writing the:
if(!class_exists('Imagick')) echo "Imagick is not installed properly"; return "Imagick is not installed properly"; try{ $image = new imagick($source); $image->setResolution( 800, 800 ); $image->setImageFormat( "png" ); $image->writeImage($dest); } catch(Exception $e){ return ''; }
part of the functions.php which converts the pdf to the png/jpg.
However, I’m sure I won’t be the only person who comes across this issue on shared hosting, as an author you would obviously know how best to write this as another function for users to have access to. If you’re able to help then thanks
Thanks
Nate
Doing some research I believe that the server guys at my clients hosting, who informed us that imageMagik is installed, are not telling a porky. In fact I think it’s a php extension that’s required, but missing:
http://uk3.php.net/manual/en/book.imagick.php
Would this be correct, I assume this is how you hook into the imageMagic functionality?
Silly.. cannot believe I didn’t think to look in your functions.php for a reference to that. I can see it’s just wrapped in an if statement looking for the class – so easy to test.
I’ll get onto them – thanks for looking into it though. Very much appreciated.
Hi Shaon,
I’ve just found out that the server does actually have imageMagik installed, however it’s shared hosting. Might this have something to do with it why it’s not working?
Version: ImageMagick 6.8.3-6 2013-03-15 Q16
Yes I don’t have that installed on the server. Once installed is there any configuration or pointing that needs to be done? Or should it just work?
As this is obviously the issue, I’ll halt on getting you admin access for now.
Thanks for the help
Hi again.. so I’ve tried the function you reference from within the archive-wpdmpro.php, like:
<?php wpdm_pdf_preview($post->ID, 200, 200); ?>
This is within the loop, however I cannot get a preview to show. Looking at the source output all I get is
<img src="" alt="MY SITE TITLE">
I’ve checked that the #id passed into the function is correct to that post, which it is. To me it’s like the pdf preview creator isn’t functioning. To which i’ve looked in uploads and cannot see any png/jpg versions of the pdf uploaded.
Thanks.