Imagemagick PHP stopped working on update
-
- Posts: 22
- Joined: 2016-05-21T14:59:43-07:00
- Authentication code: 1151
Imagemagick PHP stopped working on update
Hi,
i am looking for some help. My hosting company (Heart internet) updated their php & imagemagick last week & now my script has partially stopped working.
My script takes either a pre-defined image or user uploaded image & then adds a picture frame with/without a mount to give an instant preview of a picture frame they can order.
The script is still working correctly by sizing the image, adding the mount board & then adds on the frame but it then doesn't overlay the set frame image and tile it around the edge.
Can anyone help? I've spent hours trying different things & google has no recent help either.
Thanks
i am looking for some help. My hosting company (Heart internet) updated their php & imagemagick last week & now my script has partially stopped working.
My script takes either a pre-defined image or user uploaded image & then adds a picture frame with/without a mount to give an instant preview of a picture frame they can order.
The script is still working correctly by sizing the image, adding the mount board & then adds on the frame but it then doesn't overlay the set frame image and tile it around the edge.
Can anyone help? I've spent hours trying different things & google has no recent help either.
Thanks
- 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
What do you get from
convert -version
Find where IM resides. Perhaps they have moved it and so it does not connect with PHP.
Are you using Imagemagick in PHP exec or Imagick API. Perhaps you were using Imagick and it did not get loaded with your ISPs reload or Imagick cannot find Imagemagick any longer.
convert -version
Find where IM resides. Perhaps they have moved it and so it does not connect with PHP.
Are you using Imagemagick in PHP exec or Imagick API. Perhaps you were using Imagick and it did not get loaded with your ISPs reload or Imagick cannot find Imagemagick any longer.
-
- Posts: 22
- Joined: 2016-05-21T14:59:43-07:00
- Authentication code: 1151
Re: Imagemagick PHP stopped working on update
I am using PHP exec, imagemagic works because it reacts to the resize, borders etc commands when executed. It is failing to tile the chosen image around the edge.
See this link for an example: http://www.westendframes.co.uk/inc/crea ... 3863000495
It has added on a frame with 45° corners but it doesn't add the frames anymore.
Thanks
Tom
See this link for an example: http://www.westendframes.co.uk/inc/crea ... 3863000495
It has added on a frame with 45° corners but it doesn't add the frames anymore.
Thanks
Tom
- 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 the original images and your code using values not variables, so we can test your exact command. Also post the good and bad output.
Again what is your IM version and your platform?
convert -version
Again what is your IM version and your platform?
convert -version
-
- Posts: 22
- Joined: 2016-05-21T14:59:43-07:00
- Authentication code: 1151
Re: Imagemagick PHP stopped working on update
When executing convert -version this is the result: Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib jng jpeg ltdl openexr pangocairo png ps rsvg tiff wmf x xml zlib
For the script, the images it produces...
currently being produced: http://www.westendframes.co.uk/inc/crea ... 3870113648
This is what used to be produced: http://www.westendframes.co.uk/creations/example.jpg
Script:
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.png -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 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 http://www.westendframes.co.uk/creations/123456.jpg);
For the script, the images it produces...
currently being produced: http://www.westendframes.co.uk/inc/crea ... 3870113648
This is what used to be produced: http://www.westendframes.co.uk/creations/example.jpg
Script:
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.png -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 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 http://www.westendframes.co.uk/creations/123456.jpg);
Last edited by iwantmedia on 2016-05-21T16:06:58-07:00, edited 1 time in total.
- 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
You still have not told me the exact IM version from
convert -version
Where are your source images? We cannot test your code without them!
convert -version
Where are your source images? We cannot test your code without them!
-
- Posts: 22
- Joined: 2016-05-21T14:59:43-07:00
- Authentication code: 1151
Re: Imagemagick PHP stopped working on update
Answer modified above.
Script running: echo exec(convert -version);
Returns:
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib jng jpeg ltdl openexr pangocairo png ps rsvg tiff wmf x xml zlib
Script running: echo exec(convert -version);
Returns:
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib jng jpeg ltdl openexr pangocairo png ps rsvg tiff wmf x xml zlib
- 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
Your output is missing the first few line:
convert -version
Version: ImageMagick 6.9.4-2 Q16 x86_64 2016-05-12 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib
convert -version
Version: ImageMagick 6.9.4-2 Q16 x86_64 2016-05-12 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib jbig jng jp2 jpeg lcms lqr ltdl lzma openexr png ps rsvg tiff webp x xml zlib
- 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
This works perfectly fine for me on IM 6.9.4.2 Q16 Mac OSX
Try adding the parentheses and the final -compose over before -composite to be sure you reset the compose method back (from -compose Dst) to -compose over.
It is possible that it is just a bug in the version you updated to. That is why I wanted to know your exact IM version.
Try this:
What do you get from:
Do you have multiple versions of IM?
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 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
Try adding the parentheses and the final -compose over before -composite to be sure you reset the compose method back (from -compose Dst) to -compose over.
It is possible that it is just a bug in the version you updated to. That is why I wanted to know your exact IM version.
Try this:
Code: Select all
<?php
exec(convert -version",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
Code: Select all
<?php
exec(type -a convert",$out,$returnval);
foreach($out as $text)
{echo "$text<br>";}
?>
-
- Posts: 22
- Joined: 2016-05-21T14:59:43-07:00
- Authentication code: 1151
Re: Imagemagick PHP stopped working on update
I have just tried the changes you suggested and still get the same result.
IM version details...
Version: ImageMagick 6.9.3-9 Q16 x86_64 2016-05-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib jng jpeg ltdl openexr pangocairo png ps rsvg tiff wmf x xml zlib
IM version details...
Version: ImageMagick 6.9.3-9 Q16 x86_64 2016-05-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib cairo djvu fontconfig freetype gslib jng jpeg ltdl openexr pangocairo png ps rsvg tiff wmf x xml zlib
- 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
It works fine for me under IM 6.9.3.9 Q16 Mac OSX.
Try either recompiling without openmp or adding -limit thread 1 right after convert
convert -limit thread 1 ... rest of your code
Try either recompiling without openmp or adding -limit thread 1 right after convert
convert -limit thread 1 ... rest of your code
- 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
I am a little puzzled by your code. I do not see the need for -compose Dst or -compose over since there is no -composite. Settings without operators do nothing. Note I have added -compose over at the end, but even that may not be needed since the default for -composite is -compose over, unless you have used some other compose earlier and I have taken them out.
So, this works fine for me without them.
If this does not work, nor the disabling of openmp or limiting the thread to 1, then I would suggest you put in +write tmpX.jpg (x=1,2...) at various places and see where the tmp is failing.
So, this works fine for me without them.
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 \
-frame 24x24+24 \
-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 \
result4.jpg
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Imagemagick PHP stopped working on update
"-frame" is sensitive to the "-compose" setting, but I don't think "Dst" here gives a different result to "Over".
snibgo's IM pages: im.snibgo.com
- 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
Thanks for the pointer. I had not considered that, but I see that it is true at http://www.imagemagick.org/script/comma ... .php#framesnibgo wrote:"-frame" is sensitive to the "-compose" setting, but I don't think "Dst" here gives a different result to "Over".
Re: Imagemagick PHP stopped working on update
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!
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>";