1 year ago

#363171

test-img

Ivan Rodríguez

Imagick/Gmagick crashing on Hostinger when converting PDF to jpg

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

php

ghostscript

imagick

gmagick

0 Answers

Your Answer

Accepted video resources