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.
iwantmedia
Posts: 22
Joined: 2016-05-21T14:59:43-07:00
Authentication code: 1151

Re: Imagemagick PHP stopped working on update

Post by iwantmedia »

snibgo wrote:My current theory is that rgb ...

Code: Select all

'rgb(107,15,15)'
... would work without the quotes, so we wouldn't know if the quotes are being ignored.

However, this ...

Code: Select all

-draw 'color 1,0 floodfill'
... needs the quotes in order to keep the three space-separated "words" together in a single argument. The symptoms are consistent with the quotes being ignored.

We still haven't seen the value of $CMD. This could provide a valuable clue.
script:

Code: Select all

$cmd = "convert -debug all \"../img/gallery/3_Queens_Parade_300_x_220_8.jpg\" -write mpr:image +delete ".
" 045a-top.jpg -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 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 -compose over -composite ".
" result.jpg 2>&1";
exec($cmd, $array);
echo $cmd:
convert -debug all "../img/gallery/3_Queens_Parade_300_x_220_8.jpg" -write mpr:image +delete 045a-top.jpg -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 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 -compose over -composite result.jpg 2>&1

error output:
Array ( [0] => 2016-05-31T08:43:39+01:00 0:00.000 0.000u 6.9.3 Configure convert.x[16052]: utility.c/ExpandFilenames/940/Configure [1] => Command line: /usr/bin/convert.x {-debug} {all} {../img/gallery/3_Queens_Parade_300_x_220_8.jpg} {-write} {mpr:image} {+delete} {045a-top.jpg} {-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} {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} {-compose} {over} {-composite} {result.jpg} [2] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: configure.c/GetConfigureOptions/679/Configure [3] => Searching for configure file: "/usr/share/ImageMagick-6/coder.xml" [4] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: configure.c/GetConfigureOptions/679/Configure [5] => Searching for configure file: "/usr/lib64/ImageMagick-6.9.3//config-Q16/coder.xml" [6] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: configure.c/GetConfigureOptions/679/Configure [7] => Searching for configure file: "/etc/ImageMagick-6/coder.xml" [8] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: configure.c/GetConfigureOptions/679/Configure [9] => Searching for configure file: "/usr/share/doc/ImageMagick-6/coder.xml" [10] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: coder.c/LoadCoderCache/826/Configure [11] => Loading coder configuration file "/etc/ImageMagick-6/coder.xml" ... [12] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Module convert.x[16052]: module.c/OpenModule/1286/Module [13] => Searching for module "JPEG" using filename "jpeg.la" [14] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Module convert.x[16052]: module.c/GetMagickModulePath/556/Module [15] => Searching for coder module file "jpeg.la" ... [16] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Module convert.x[16052]: module.c/OpenModule/1295/Module [17] => Opening module at path "/usr/lib64/ImageMagick-6.9.3//modules-Q16/coders/jpeg.la" [18] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Module convert.x[16052]: module.c/OpenModule/1322/Module [19] => Method "RegisterJPEGImage" in module "JPEG" at address 0x7fddb3373ec0 [20] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Module convert.x[16052]: module.c/OpenModule/1336/Module [21] => Method "UnregisterJPEGImage" in module "JPEG" at address 0x7fddb3373db0 [22] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Policy convert.x[16052]: policy.c/IsRightsAuthorized/574/Policy [23] => Domain: Path; rights=Read; pattern="../img/gallery/3_Queens_Parade_300_x_220_8.jpg" ... [24] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Blob convert.x[16052]: blob.c/OpenBlob/2594/Blob [25] => read 3 magic header bytes [26] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Resource convert.x[16052]: resource.c/AcquireMagickResource/313/Resource [27] => Map: 121KB/118KiB/62.495GiB [28] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Resource convert.x[16052]: resource.c/RelinquishMagickResource/1005/Resource [29] => Map: 121KB/0B/62.495GiB [30] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Cache convert.x[16052]: cache.c/DestroyPixelCache/999/Cache [31] => destroy [32] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: configure.c/GetConfigureOptions/679/Configure [33] => Searching for configure file: "/usr/share/ImageMagick-6/magic.xml" [34] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: configure.c/GetConfigureOptions/679/Configure [35] => Searching for configure file: "/usr/lib64/ImageMagick-6.9.3//config-Q16/magic.xml" [36] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: configure.c/GetConfigureOptions/679/Configure [37] => Searching for configure file: "/etc/ImageMagick-6/magic.xml" [38] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: configure.c/GetConfigureOptions/679/Configure [39] => Searching for configure file: "/usr/share/doc/ImageMagick-6/magic.xml" [40] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Configure convert.x[16052]: magic.c/LoadMagicCache/793/Configure [41] => Loading magic configure file "/etc/ImageMagick-6/magic.xml" ... [42] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Policy convert.x[16052]: policy.c/IsRightsAuthorized/574/Policy [43] => Domain: Coder; rights=Read; pattern="JPEG" ... [44] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Policy convert.x[16052]: policy.c/IsRightsAuthorized/574/Policy [45] => Domain: Path; rights=Read; pattern="../img/gallery/3_Queens_Parade_300_x_220_8.jpg" ... [46] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Blob convert.x[16052]: blob.c/OpenBlob/2594/Blob [47] => read 3 magic header bytes [48] => 2016-05-31T08:43:39+01:00 0:00.010 0.000u 6.9.3 Resource convert.x[16052]:
PLUS MUCH MORE
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Imagemagick PHP stopped working on update

Post by snibgo »

Okay, you are using backslash-doublequote, and $CMD looks good, but "-debug all" doesn't, so I suppose you get the same error:

Code: Select all

convert.x: non-conforming drawing primitive definition `color' @ error/draw.c/DrawImage/3171
Have you tried "-draw @file.txt" yet?
snibgo's IM pages: im.snibgo.com
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 do not know PHP that well, but am concerned that in your above command you use escaped double quotes and they may be getting confused with the PHP double quotes at the beginning and end of the exec command. I would use either single quotes or escaped single quotes. I do not think it got past that, since I do not see any error about draw.c any longer.

Lets ignore the $cmd and just run this straight in an exec command with the images in the same directory so no relative path ../ and no new lines. Do not quote your images, either.

Code: Select all

<?php
exec("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" 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
If that fails, then escape the single quotes.

I am still concerned that you have no lcms and something wrong with your install of imagemagick's draw.c

However, the above is really too complicated a test. If you cannot do the the simple test then there is no point in going this far.

So try again with

<?php
exec("convert -debug all -size 200x200 xc:black -fill white -draw 'rectangle 50,50 150,150' test1.jpg 2>&1",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>

We need to find out why this does not work. You should get a black background with a white square inside.
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 above still shows an error with & without the quotes.
Finally after nagging and posting the parts from this forum the ISP are almost admitting the install was wrong.
"Hi Tom,
Thanks for your time.
Our System Administrators are working on a fix for this as we speak.
Please bear with us."
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 »

-draw does need single quotes. It won't work correctly without them.

Did you test my simple command above and it failed? If so, then let us know when you get something resolved from your ISP.
Post Reply