yii imagemagick php5.4 to php7

Do you need consulting from ImageMagick experts and are willing to pay for their expertise? Or are you well versed in ImageMagick and offer paid consulting? If so, post here otherwise post elsewhere for free assistance.
Post Reply
ross77
Posts: 4
Joined: 2016-10-06T05:37:23-07:00
Authentication code: 1151

yii imagemagick php5.4 to php7

Post by ross77 »

We've been using imagemagick in Yii for a couple of years to allow people to "decorate" a balloon online. Running on php5.4 this has always worked really well. Here's an example of one of the "balloons" Image

We recently upgraded the website to run on php7 for a variety of reasons. Sadly this has meant imagemagick isn't working the way it used to. See this link for an example: Image

I wont say it's broken because I don't believe it is. I think we need to tweak/update the code. The problem is even the guy who implemented this for us can't work it out. This is the problem in his words

First command extracts the non-transparent part of the image and the second colours it. According to my tests, the first command (-alpha extract) works perfectly, however the latter (-background COLOUR -alpha shape) does colour the whole image, not just the extracted part.
Here's the code we're trying to use (and has successfully worked on php5.4 for over two years):

public function color($params) {

if (isset($params['pattern'])) {

$error = exec(escapeshellcmd($this->dir . 'convert' . $this->ext) . ' ' . $this->cmd_image . ' -alpha extract ' . $this->cmd_image);

$error .= exec(escapeshellcmd($this->dir . 'convert' . $this->ext) . ' ' . $this->cmd_image . ' tile:' . $params['pattern'] . ' \ -compose Multiply -composite ' . $this->cmd_image);

$error .= exec(escapeshellcmd($this->dir . 'convert' . $this->ext) . ' ' . $this->cmd_image . ' -background \'' . $params['color_code'] . '\' -alpha shape ' . $this->cmd_image);



if (!$error) {

return TRUE;
} else {

return FALSE;
}
} else {

$error = exec(escapeshellcmd($this->dir . 'convert' . $this->ext) . ' ' . $this->cmd_image . ' -alpha extract ' . $this->cmd_image);


$error .= exec(escapeshellcmd($this->dir . 'convert' . $this->ext) . ' ' . $this->cmd_image . ' -background \'' . $params['color_code'] . '\' -alpha shape ' . $this->cmd_image);


if (!$error) {

return TRUE;
} else {

return FALSE;
}
}
}

The boss is more than happy to pay for help on fixing this.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: yii imagemagick php5.4 to php7

Post by snibgo »

What version of IM are you using? (And what version were you using, before the upgrade?)

To diagnose the problem, we need to reproduce it. Please provide example(s) for $this->cmd_image and $params['pattern'] and $params['color_code'].
snibgo's IM pages: im.snibgo.com
ross77
Posts: 4
Joined: 2016-10-06T05:37:23-07:00
Authentication code: 1151

Re: yii imagemagick php5.4 to php7

Post by ross77 »

Hi,
We're using ImageMagick 7.0.2-7 Q16 x86_64 2016-08-08 apparently.

I'll try to get them - this php carry on isn't my expertise ;-)

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

Re: yii imagemagick php5.4 to php7

Post by fmw42 »

I have moved this topic to the Users forum, since there was no mention of PAID consulting.
ross77
Posts: 4
Joined: 2016-10-06T05:37:23-07:00
Authentication code: 1151

Re: yii imagemagick php5.4 to php7

Post by ross77 »

Apart from this line:

The boss is more than happy to pay for help on fixing this.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: yii imagemagick php5.4 to php7

Post by fmw42 »

I have moved it back to Consulting
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: yii imagemagick php5.4 to php7

Post by fmw42 »

It would be most helpful if you could provide an example input image (the same as above) and your exact commands with values substituted for your arguments. It is very hard to follow and reproduce from code with argument in it, not knowing what those arguments mean or the range of values. So please make a simple example to demonstrate the problem.

Can you reproduce the problem outside of PHP, that is just a simple IM command line run from the terminal?
ross77
Posts: 4
Joined: 2016-10-06T05:37:23-07:00
Authentication code: 1151

Re: yii imagemagick php5.4 to php7

Post by ross77 »

Hi,

Thanks for the reply. I've uploaded an example image here: https://i.stack.imgur.com/a4ndh.png

You'll have to bear with me on the other questions - I have to reply on someone else getting this info for me. I will post the answers as soon as I get them.

Thanks again.
Post Reply