0

I have PDF documents created using FPDF and I wish to convert to jpg for displaying purposes. I believe I have installed Imagick correctly and set the php.ini file to see it but when I try to suck it into my code I get the Class "Imagick" not found error message. Does this mean I haven't installed it correctly or is my code below not right?

    if (\file_exists($cert)) {
        
        $im = new \Imagick($cert.'[0]');
        $im->setImageFormat('jpg');
        header('Content-Type: image/jpg');
        echo $im;

    }

As always any guidance appreciated. I'm using php8.2 and I'm using WAMP on a windows machine.

4
  • 1
    The format looks to be okay. Have you run a phpinfo() against your environment to check if Imagick is installed and listed?
    – Irata
    Commented Feb 4 at 23:34
  • Yes I've checked that php has the extension set but when I run the above code I get the class not found message. After reading all the instructions and hints/tips, I think I must have something wrong with my local path settings within WAMP so nothing to do with Joomla. Sorry to be a nuisance. I'll try my code on an active site to test. Cheers. Commented Feb 6 at 4:06
  • Are you trying to run the above code from a Terminal,(CMD) as a CLI or part of Joomla instance? Using a Terminal or CMD command will use your Windows Path statements to find PHP which can be a different implementation of PHP to the one you have in your WAMP that is accessed via a CLI or Web url.
    – Irata
    Commented Feb 6 at 12:04
  • Ok, but no I'm using it in my Joomla! component. My component creates a PDF certificate and I wanted to be able to display it as a thumbnail image. Commented Feb 7 at 19:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.