Code: Select all
$urlArq = $_REQUEST["url"];
$pag = $_REQUEST["pag"];
$largura = $_REQUEST["w"];
$a = (297/210);
$altura = round($largura*$a);
$Img = new Imagick();
//$Img->setSize($largura, $altura);
$Img->setResolution(150, 150);
$Img->readImage($urlArq."[".$pag."]");
$Img = $Img->flattenImages();
$Img->setImageFormat("jpeg");
$imgw = $Img->getImageWidth();
$imgh = $Img->getImageHeight();
//$image = $Img->getImageBlob();
//$image = $Img->thumbnailImage($largura, NULL);
$imagefull = imagecreatefromstring($Img->getImageBlob());
$image = imagecreatetruecolor($largura, $altura);
imagecopyresampled($image, $imagefull, 0, 0, 0, 0, $largura, $altura, $imgw, $imgh);
if($image){
header("Content-Type: image/jpeg");
echo(imagejpeg($image));
} else {
echo("Erro! Imagem não criada.");
}
It seams ImageMagick can't find Ghostscript, can't use it or can write where suppose to. I have a Mac OS X Lion, so I get the Ghostscript 9.16 from Richard Koch Home Page (http://pages.uoregon.edu/koch/). I talk with him but he said that it's better get the source code and do my own compilation. The source are in http://www.ghostscript.com. The 9.16 tar gz file didn't open so I taken 9.15. I also had to in install Xcode and Command Line Tools… all day fixing bugs! So I tried to compile using Richard's instructions, but the Terminal is full of error messages, I don't know where to start.PHP Fatal error: Uncaught exception 'ImagickException' with message 'Postscript delegate failed `/Library/WebServer/Documents/www/sintran/apitaco/edicao-03-005-12-2013.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/713' in /Library/WebServer/Documents/www/sintran/conteudo_apitaco_jpeg.php:10
The gs still works, the gs -v command returns
It means to me the version I tried to compile was not compiled or not installed.GPL Ghostscript 9.16 (2015-03-30)
Copyright (C) 2015 Artifex Software, Inc. All rights reserved.
I think I need more information, but I don't know how to get it, don't know exactly what to answer to Richard so he can help me with Ghostscript - if the problem is Ghostscript.