newPseudoImage not working - please help!

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
spaced
Posts: 4
Joined: 2017-07-04T01:50:49-07:00
Authentication code: 1151

newPseudoImage not working - please help!

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: newPseudoImage not working - please help!

Post by snibgo »

You might say what values you have tried in "$canvasType".
snibgo's IM pages: im.snibgo.com
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: newPseudoImage not working - please help!

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: newPseudoImage not working - please help!

Post 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.
snibgo's IM pages: im.snibgo.com
spaced
Posts: 4
Joined: 2017-07-04T01:50:49-07:00
Authentication code: 1151

Re: newPseudoImage not working - please help!

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: newPseudoImage not working - please help!

Post by snibgo »

Yes, the image name has five characters, including a colon (probably any case). The context determines when it needs to be quoted.
snibgo's IM pages: im.snibgo.com
Post Reply