Imagick/Gmagick crashing on Hostinger when converting PDF to jpg

600 views Asked by At

I'm trying to get it to work using PHP on Hostinger.

I have tried the following:

$white=new Imagick($fichero["tmp_name"]); $white->setImageFormat('jpg'); $nombre = explode(".", $fichero["name"]); $white->writeImage($path.$nombre[0].'.jpg'); $white->clear(); $white->destroy();

It tells me Ghostscript is missing. Ok, then i try to launch it by exec:

exec("convert -density 150 '".$pathPdf.$fichero["name"]."' -quality 90 output-%3d.jpg 2>&1";

Convert prints:

Array ( [0] => sh: convert: command not found )

exec("gm convert '".$pathPdf.$fichero["name"]."' '".$pathPdf."testing-%3d.jpg' 2>&1",$asd);

GM prints:

Array ( \[0\] =\> execvp failed, errno = 2 (No such file or directory) \[1\] =\> gm convert: "gs" "-q" "-dBATCH" "-dSAFER" "-dMaxBitmap=50000000" "-dNOPAUSE" "-sDEVICE=ppmraw" "-dTextAlphaBits=4" "-dGraphicsAlphaBits=4" "-r72x72" "-sOutputFile=/tmp/gmVkgulI" "--" "/tmp/gmbA23ic" "-c" "quit". \[2\] =\> gm convert: Postscript delegate failed (/home/u227315269/domains/pruebasivan.online/public_html/prueba/mediaUsuarios/1/4/certificado.pdf). )

An idea to be able to convert a pdf in Hostinger to images?

Thanks in advance

0

There are 0 answers