PHP CodeIgnitor Image Manipulation Blur?

Hi experts,

I need to get a blur effect for an image handled with CodeIgnitor. I know how to resize, crop etc. in CI images but there is no action available inside the image manipulation class from CI to blur an image.

How could I get this done? Can I use/add a filter from dg2 to blur my image? (or any other library)

In the moment I do basically the following steps

$resize_config['image_library'] = 'gd2';
$resize_config['create_thumb'] = TRUE;
$resize_config['thumb_marker'] = false;
$resize_config['maintain_ratio'] = true;
$sourcePath = isset($config['upload_path'])?$config['upload_path']:$imgPath.'original/';
$sourcePath .= isset($new_file_name)?$new_file_name:$new_file;         
$destinationPath = $paths['path'];
$destinationPath .= isset($new_file_name)?$new_file_name:$new_file;
$resize_config['source_image']= $sourcePath;
$resize_config['width'] = $paths['width'];
$resize_config['height']= $paths['height'];
$resize_config['new_image'] = $destinationPath;
$resize_config['quality'] = '80%';


Open in new window

The result I am looking for is something like this

Thanks for your tips in advance....
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
What is the name / source of the image manipulation class?  Maybe it can be extended to add a blur method?
Oliver2000Author Commented:
I use right now only the internal image manipulation class from CodeIgnitor and in this case gd2.
Ray PaseurCommented:
OK, let me see if I can get it to take a blur method.  I won't be able to test completely since I do not have an instance of CI on this machine, but I may be able to make some progress with gd2.
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Ray PaseurCommented:
Here is a pure PHP solution.  Try these links:

There may be a better filter for your exact needs, but IMG_FILTER_GAUSSIAN_BLUR is a decent place to start.
<?php // demo/temp_pierrek.php


$url = '';
$img = imageCreateFromPNG($url);

$blur = !empty($_GET['blur']) ? (int)$_GET['blur'] : 0;

for ($x=1; $x<=$blur; $x++)
    imagefilter($img, IMG_FILTER_GAUSSIAN_BLUR);

header('Content-type: image/png');


Open in new window

Next steps would be to figure out how to extend the CI->image_lib class.

This seems to have some good information in the part about Extending Native Libraries

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Oliver2000Author Commented:
This actually works flawless. Thank you Ray for this fast and easy solution.
Ray PaseurCommented:
Glad to help!  Thanks for the points and thanks for using E-E-, ~Ray
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.