Jump to content

Recommended Posts

Posted

Hi,

I moved from Stevie to Tommy recently but some of my scripts are not working. After checking, I found that Imagick is missing from the server. I would like to know whether Imagick had been installed on the server. Thank you.

  • 2 weeks later...
Posted

It should be working for PHP Version 5.4.45 on Tommy.

 

But my script is not working showing error 500, also when checked it seemed Imagick is not installed. My code is as below:

 

$im = new Imagick();
$im->pingImage('abc.pdf');
$page=$im->getNumberImages();

This was working fine in Stevie. Please help me.

Posted

This works for me:

 

 

<?php
$blob = file_get_contents("http://url-of-pdf.pdf");
$image = new imagick();
$image->readImageBlob($blob);
$image_count = $image->getNumberImages();
echo $image_count;
?>
Posted

 

It should be working for PHP Version 5.4.45 on Tommy.

 

But my script is not working showing error 500

 

Also, aside from trying Byron's code, did you change the PHP version? Tommy uses 5.6 by default, which I don't believe has Imagick.

Posted

 

This works for me:

<?php
$blob = file_get_contents("http://url-of-pdf.pdf");
$image = new imagick();
$image->readImageBlob($blob);
$image_count = $image->getNumberImages();
echo $image_count;
?>

 

Still showing the Error 500. I changed my code and used This code but it's not working too.

 

 

 

 

It should be working for PHP Version 5.4.45 on Tommy.

 

But my script is not working showing error 500

 

Also, aside from trying Byron's code, did you change the PHP version? Tommy uses 5.6 by default, which I don't believe has Imagick.

 

The PHP version is 5.6.24. I too doubt magick is not installed when I checked. How should i change it to 5.4?

Posted

It will always show the primary version as 5.6. As long your domains are set to 5.4, the scripts on those domains should run under 5.4. It should take effect nearly instantly.

Posted

It will always show the primary version as 5.6. As long your domains are set to 5.4, the scripts on those domains should run under 5.4. It should take effect nearly instantly.

 

Hi,

It's working fine now. But there is a problem, the converted image from pdf is blotted. I'll attach the image of both the original PDF(Img1) and the Converted image (Img2). Could you please suggest me any reason for this because in Stevie it was working fine.

 

This One is Original PDF

 

 

 

 

This one is the Converted Image

 

Posted

PHP Version:

http://krydos.heliohost.org/54/phpinfo.php

 

Input:

http://krydos.heliohost.org/54/pdf-sample.pdf

 

Code:

<?php

$myurl = "pdf-sample.pdf";
$image = new Imagick($myurl);
$image->setResolution(300, 300);
$image->setImageFormat("png");
$image->writeImage("pdf-sample.png");
Output:

http://krydos.heliohost.org/54/pdf-sample.png

 

I shrank the pdf a bit to make the image and it still looks pretty sharp to me.

Posted

PHP Version:

http://krydos2.heliohost.org/54/phpinfo.php

 

Input:

http://krydos2.heliohost.org/54/pdf-sample.pdf

 

Code:

<?php

$myurl = "pdf-sample.pdf";
$image = new Imagick($myurl);
$image->setResolution(300, 300);
$image->setImageFormat("png");
$image->writeImage("pdf-sample.png");
Output:

http://krydos2.heliohost.org/54/pdf-sample.png

 

I shrank the pdf a bit to make the image and it still looks pretty sharp to me.

 

 

 

The problem is converting to JPG is creating blotting. If converted to PNG it is OK.

Guest
This topic is now closed to further replies.
×
×
  • Create New...