Using imageMagick within Concrete5

I'm attempting to utilize imageMagick to automatically blur a image and then output that image's source so that I can use it as a background-image.

imageMagick is running on my server, I've confirmed this with the host and with a quick raw test file I threw up there. It worked great.

Now I'm trying to make it function within a page template in concrete5. At first I thought I was going to have to extend the image helper to somehow look for imageMagick and do the blur as some function. The problem with this is that I really don't know what the hell I'm doing in there lol. I tried following along some posts I've found on the forums here for extending helpers but I was not having any luck and I think lack of heavier lifting development experience was not helping my cause.

So I moved on to just trying to put the code in the page... which is probably not the best method but I was hoping it would at least give me some hints for moving forward. So I started with my home.php page type and dropped this in just below the header include ($this->inc('elements/header.php');)

// Grabbing the image helper
$ih = Loader::helper('image');
// Here's the attribute for the image I'm choosing from the file manager
$introImageFile = $c->getAttribute('page_intro_image');
$introImg = $ih->getThumbnail($introImageFile, 2000, 9999, false);
// Initially I thought imageMagick was having a hard time with the src not having the full url so I strung those together here
$introImgPath = BASE_URL . $introImg->src;
// Now I call on imageMagick to do it's thing...
$introBlurImg = new Imagick( $introImgPath );

If I echo that $introBlurImg now... it just outputs as a huge block of garbage like @$HJHJKFH#*($&@[email protected](*U#(*@U$... so on, so forth.

I realized a little later that what was missing from my test that worked outside of concrete was this bit...
header('Content-type: image/jpeg');

Problem is, I only know enough PHP to be dangerous, working with if statements, so on. This is beyond my know-how. So I hit up to try to learn more and it really only left me more confused. Including that snippet seems to over ride anything on the page output a empty img container.

To go one further, even if this did work it doesn't really help me get the SRC of the new blurry image file so I can use it as a background-image: url(src);

So poking around the forums I've seen various mentions of imagemagick here and there, so I think others have found success using it for it's various other functions. Hopefully they will have some insights into how I may do this. Thanks much in advance!

View Replies: View Best Answer
JohntheFish replied on at Permalink Best Answer Reply
Its ages since I have poked about with Image Magick. For the sort of effect you are looking for, consider look at hereNT's background addon. It uses an overlay to achieve a similar effect and looks remarkably good, even when stretching comparatively low resolution images.

EDIT, just checked, it was the Vegas variation I was thinking of:
SpatialAnomaly replied on at Permalink Reply
Hey, thanks for your input John... That is an interesting effect I hadn't considered something like that as an overlay. I'll keep it in mind.

I ended up stopping trying to do the blur automatically and am just blurring in photoshop and having two versions, a clear and low res blurred version.

I then borrowed some code from the Matt DuVall (, who actually suggests imagemagick in his article but I ignored it there too. Just going to do it manually, I'll be managing the site myself so it's not a big deal.