yii imagemagick php5.4 to php7
<p>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"
<a href="http://i.stack.imgur.com/VEeOp.png" rel="nofollow">balloon with working decorator</a>
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:
<a href="http://i.stack.imgur.com/nZhWo.png" rel="nofollow">balloon without working decorator</a>
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</p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>Here's the code we're trying to use (and has successfully worked on php5.4 for over two years):</p>

<pre><code>  public function color($params) {

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

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

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

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



        if (!$error) {

            return TRUE;
        } else {

            return FALSE;
        }
    } else {

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


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


        if (!$error) {

            return TRUE;
        } else {

            return FALSE;
        }
    }
}
</code></pre>

<p>Any and all suggestions as to what we're doing wrong in php7 gratefully received!</p>

<p>Thanks :)</p>