Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compilation when imagemagick is v7 #12493

Closed
wants to merge 34 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions phalcon/image/adapter/imagick.zep
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,22 @@ class Imagick extends Adapter
*/
protected function _watermark(<Adapter> image, int offsetX, int offsetY, int opacity)
{
var watermark, ret;
var watermark, ret, imagickVersion, method;

let opacity = opacity / 100,
watermark = new \Imagick();
watermark = new \Imagick(),
imagickVersion = \Imagick::getVersion();

preg_match("/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/", imagickVersion["versionString"], imagickVersion);

if version_compare(imagickVersion[1], '7') < 0 {
Copy link
Contributor

@sergeyklay sergeyklay Dec 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'7' -> "7"

let method = "setImageOpacity";
} else {
let method = "setImageAlpha";
}

watermark->readImageBlob(image->render());
watermark->setImageOpacity(opacity);
watermark->{method}(opacity);

this->_image->setIteratorIndex(0);

Expand Down