Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Report all errors
- ini_set("display_errors", "1");
- error_reporting(E_ALL);
- function imagecolorfilter($im){
- $height = imagesy($im);
- $width = imagesx($im);
- for($x=0; $x<$width; $x++){
- for($y=0; $y<$height; $y++){
- $rgb = ImageColorAt($im, $x, $y);
- $r = ($rgb >> 16) & 0xFF;
- $g = ($rgb >> 8) & 0xFF;
- $b = $rgb & 0xFF;
- $c=($r+$g+$b)/3;
- if($r<$g+10 || $r<$b){$r=$c;$g=$c; $b=$c;}//only red
- imagesetpixel($im, $x, $y,imagecolorallocate($im, $r,$g,$b));
- }
- }
- }
- if(isset($_GET['source'])){
- $image = filter_var($_GET['source'], FILTER_SANITIZE_STRING);
- $image = imagecreatefromjpeg($image);
- imagefilter($image, IMG_FILTER_MEAN_REMOVAL);
- imagefilter($image, IMG_FILTER_COLORIZE, 10, 10, 10);
- //bluring
- $gaussian = array(array(1.0, 2.0, 1.0), array(2.0, 4.0, 2.0), array(1.0, 2.0, 1.0));
- imageconvolution($image, $gaussian, 16, 0);
- imagecolorfilter($image);
- header('content-type: image/jpeg');
- imagejpeg($image, '', 10);
- imagedestroy($image);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement