Imagemagick PHP stopped working on update

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick PHP stopped working on update

Post by fmw42 »

Bonzo, you are right. I had not noticed before, but the inner golden frame is missing in my command also.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Imagemagick PHP stopped working on update

Post by Bonzo »

I can see you got past my anti spammer g o l d problem with golden fmw42!
iwantmedia
Posts: 22
Joined: 2016-05-21T14:59:43-07:00
Authentication code: 1151

Re: Imagemagick PHP stopped working on update

Post by iwantmedia »

Hi,

thank you everyone for your kind help. I have tried all suggestions posted & the result is still the same.
Could it be a folder permission issue?
The site is hosted on a shared server.

I wish heart internet had never updated the software.

Thanks
Tom
iwantmedia
Posts: 22
Joined: 2016-05-21T14:59:43-07:00
Authentication code: 1151

Re: Imagemagick PHP stopped working on update

Post by iwantmedia »

Bonzo wrote:Out of interest I ran the original code on my localhost ( version 6.9.3 ) and had the same result as iwantmedia. Changing to the code below worked - note I had to use \" instead of ' as I am on a windows localhost. I have also added some error reporting and the code should still run on a Linux type server.

Sorry there is still a problem; looking at the output and the original frame the maroon colour is over the g o l d part of the frame and it should be behind it and the picture is over the picture matte edge. It looks like the pictures are composeted in the wrong order. But at least the frame is there!

Code: Select all

$array=array();

exec("convert http://www.westendframes.co.uk/img/gallery/3_Queens_Parade_300_x_220_8.jpg -write mpr:image +delete  http://www.westendframes.co.uk/img/frame/045a-top.png -write mpr:edge_top +delete  http://www.westendframes.co.uk/img/frame/045a-bottom.jpg -rotate 180 -write mpr:edge_btm +delete  mpr:image -alpha set -bordercolor \"rgb(107,15,15)\" -border 80  -compose Dst -frame 24x24+24 -compose over  -transverse -tile mpr:edge_btm -draw \"color 1,0 floodfill\" -transpose -draw \"color 1,0 floodfill\"  -transverse -tile mpr:edge_top  -draw \"color 1,0 floodfill\" -transpose -draw \"color 1,0 floodfill\"  mpr:image -gravity center -composite 123456.jpg 2>&1", $array);  
echo "<br>".print_r($array)."<br>";  
echo "</pre>";
Here is the code i get from the returned array:
Array ( [0] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [1] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [2] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [3] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [4] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [5] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [6] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [7] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [8] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [9] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [10] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [11] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [12] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [13] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [14] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [15] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [16] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [17] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [18] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [19] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [20] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [21] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [22] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [23] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [24] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [25] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [26] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [27] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [28] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. )
1
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Imagemagick PHP stopped working on update

Post by Bonzo »

Now I had those errors as well but when I removed all the \ from the code it fixed it.

The code as posted may have had line breaks inserted by the forum; the original was all on one line.

I tend to write my code slightly differently these days but sometimes it can cause an error depending where I put the breaks. A simple example:

Code: Select all

$cmd = " input.jpg -resize 100x100".
 " -bordercolor black -border 5x5 ";

exec(" convert $cmd output.jpg ");
This makes the code easier to read as you can have each operation on a line and you can echo $cmd and when you have variables it is easy to see if they are what you expected them to be.
As I say there can be problems if you breakup the code in in the wrong places.

P.S. The errors can be confusing sometimes as they can be caused by something going wrong before the code that creates the error. But at least you know there is a problem with your code.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick PHP stopped working on update

Post by fmw42 »

I am not sure why you are not getting the edge images to show, but to get the golden part to show you must use the thickness of the border images as the arguments in your -frame. Your top and bottom images are 60 pixels thick (vertical dimension). So -frame 60x60+60 will get the golden part back

Code: Select all

convert \( 3_Queens_Parade_300_x_220_8.jpg -write mpr:image +delete \) \
\( 045a-top.png -write mpr:edge_top +delete \) \
\( 045a-bottom.jpg -rotate 180 -write mpr:edge_btm +delete \) \
mpr:image -alpha set -bordercolor 'rgb(107,15,15)' -border 80 \
-compose Dst -frame 60x60+60 -compose over \
-transverse -tile mpr:edge_btm -draw 'color 1,0 floodfill' \
-transpose -draw 'color 1,0 floodfill' \
-transverse -tile mpr:edge_top -draw 'color 1,0 floodfill' \
-transpose -draw 'color 1,0 floodfill' \
mpr:image -gravity center -compose over -composite \
result.jpg
iwantmedia
Posts: 22
Joined: 2016-05-21T14:59:43-07:00
Authentication code: 1151

Re: Imagemagick PHP stopped working on update

Post by iwantmedia »

I'm still having the same issue, the script is running and alters the frame thickness and size depending on the users selections however it just doesn't add the picture and tile it to create the picture frame.

Very frustrating.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick PHP stopped working on update

Post by fmw42 »

Try running my command above with actual images and values and not variables. Also remove the new line \ at the end of each line above so that it is one long command on one line. Leave the \ before the parens. What are the error messages for that?
iwantmedia
Posts: 22
Joined: 2016-05-21T14:59:43-07:00
Authentication code: 1151

Re: Imagemagick PHP stopped working on update

Post by iwantmedia »

fmw42 wrote:Try running my command above with actual images and values and not variables. Also remove the new line \ at the end of each line above so that it is one long command on one line. Leave the \ before the parens. What are the error messages for that?
Here is the code i am running...
$array=array();

exec("convert \( http://www.westendframes.co.uk/img/gall ... _220_8.jpg -write mpr:image +delete \) \( http://www.westendframes.co.uk/img/frame/045a-top.jpg -write mpr:edge_top +delete \) \( http://www.westendframes.co.uk/img/fram ... bottom.jpg -rotate 180 -write mpr:edge_btm +delete \) mpr:image -alpha set -bordercolor 'rgb(107,15,15)' -border 80 -compose Dst -frame 60x60+60 -compose over -transverse -tile mpr:edge_btm -draw 'color 1,0 floodfill' -transpose -draw 'color 1,0 floodfill' -transverse -tile mpr:edge_top -draw 'color 1,0 floodfill' -transpose -draw 'color 1,0 floodfill' mpr:image -gravity center -compose over -composite result.jpg 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";

Here is the output...
Array ( [0] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [1] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [2] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [3] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [4] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [5] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [6] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [7] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [8] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [9] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [10] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [11] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [12] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [13] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [14] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [15] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [16] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [17] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [18] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [19] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [20] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [21] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [22] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [23] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [24] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [25] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [26] => convert.x: unable to open image `floodfill': No such file or directory @ error/blob.c/OpenBlob/2702. [27] => convert.x: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501. [28] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. )
1
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick PHP stopped working on update

Post by fmw42 »

Are you using http: accessed images or are these just there for links to access your images. If the former, the new IM has more restricted security policies and that might be the issue.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick PHP stopped working on update

Post by fmw42 »

We have deleted your post to Consulting forum, since you should not post twice on any give topic and the Consulting forum is for Paid consulting only.
iwantmedia
Posts: 22
Joined: 2016-05-21T14:59:43-07:00
Authentication code: 1151

Re: Imagemagick PHP stopped working on update

Post by iwantmedia »

No I'm using local image links. The http is just for user reference to view the resources.

Ok I just wanted to see of anyone would be willing to take a look because my client is getting worried the main feature of his site isn't working & could be losing custom & I have spent hours altering and trying different things to try and get it working again.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick PHP stopped working on update

Post by fmw42 »

Array ( [0] => convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171. [1] => convert.x: unable to open image `1,0': No such file or directory @ error/blob.c/OpenBlob/2702. [2] => convert.x:
It does not seem to like your color draw command. Have you checked to see if your PHP file has any corrupt or malformed characters that appear to view correctly but are not proper such as a long or short hyphen rather than a normal hyphen for -draw?

I do not understand convert.x? What platform are you on?

try escaping the single quotes

Code: Select all

-draw \'color 1,0 floodfill\' 
or using and escaping double quotes (as bonzo suggested)

Code: Select all

-draw \"color 1,0 floodfill\" 
You might also need to escape the quotes as above for 'rgb(107,15,15)'

Is it possible that your ISP has linked PHP to a very old version of IM? Try putting the full path to convert in your PHP command using the version of IM you think you should be using.

I think I see what may be the issue. Your delegates do not include lcsm(2) and thus has no color management. Try installing lcms and then reinstall IM. See http://www.littlecms.com/
iwantmedia
Posts: 22
Joined: 2016-05-21T14:59:43-07:00
Authentication code: 1151

Re: Imagemagick PHP stopped working on update

Post by iwantmedia »

The site is hosted on a Linux shared server with heart internet.
How would I check if the php file characters are corrupt?
I've tried escaping the quotes both single & double but it doesn't change anything.
How do you add the full path on the convert command?
Can lcms be added to a shared server?

Thanks for your help.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Imagemagick PHP stopped working on update

Post by fmw42 »

iwantmedia wrote:The site is hosted on a Linux shared server with heart internet.
How would I check if the php file characters are corrupt?
I've tried escaping the quotes both single & double but it doesn't change anything.
How do you add the full path on the convert command?
Can lcms be added to a shared server?

Thanks for your help.
Check your PHP file in a text editor for bad characters and make sure your hyphens are normal (not short or long) hyphens.

Find your path to convert or ask your ISP for the path.

Code: Select all

type -a convert
should tell you what is in your PATH. Put that in an exec command and see what it returns.

Once you have the path, then modify your commmand as follows

Code: Select all

exec("path2/convert ...
Ask your ISP to compile lcms v2 and then recompile Imagemagick. This is their job to make sure all the needed delegates are available and this one should have been added. Imagemagick does rely upon it for color management. Whether that is your problem or not, it still should be there as a listed delegate.
Post Reply