Page 1 of 1

newPseudoImage not working - please help!

Posted: 2017-07-17T03:01:32-07:00
by spaced
Hi

I've been struggling with this for several days now, so I'm hoping someone can guide me in the right direction.

I'm trying to get newPseudoImage working but any scripts with it in keeps throwing up a 500 Internal Server Error.

Example taken from http://phpimagick.com/Imagick/newPseudoImage

Code: Select all

<?php

newPseudoImage('logo');

function newPseudoImage($canvasType)
{
    $imagick = new \Imagick();
    $imagick->newPseudoImage(300, 300, $canvasType);
    $imagick->setImageFormat("png");
    header("Content-Type: image/png");
    echo $imagick->getImageBlob();
}

?>
I haven't had any problems with any of the other imagemagick/imagick functionality, everything works except newPseudoImage so I'm really confused!

I'm running ImageMagick 6.8.9-9 Q16 x86_64 on Ubuntu 16.04

If anyone has any suggestions I would be very grateful.

Re: newPseudoImage not working - please help!

Posted: 2017-07-17T07:19:30-07:00
by snibgo
You might say what values you have tried in "$canvasType".

Re: newPseudoImage not working - please help!

Posted: 2017-07-17T07:38:22-07:00
by Bonzo
The imagick code is within a function and the function is called with newPseudoImage('logo'); so $canvasType should contain logo

Checking out this page and logo is not listed http://www.imagemagick.org/script/formats.php#pseudo

Re: newPseudoImage not working - please help!

Posted: 2017-07-17T08:05:30-07:00
by snibgo
Ah, yes, "logo", I didn't see that (must be going blind).

Looking at the source code of the linked page, $canvasType is set to "LOGO:", with a colon (no quotes). So it needs the colon, in the usual IM way.

Re: newPseudoImage not working - please help!

Posted: 2017-07-17T09:34:04-07:00
by spaced
Snibgo, Bonzo - Thank you!

Yes, it needed the colon. It didn't even occur to me to check the source code of the linked page :/

Incidentally it did need the quotes when it was being called from the function, so:

Code: Select all

newPseudoImage('LOGO:');


Thanks again for your help!

Re: newPseudoImage not working - please help!

Posted: 2017-07-17T13:02:05-07:00
by snibgo
Yes, the image name has five characters, including a colon (probably any case). The context determines when it needs to be quoted.