OK! since php v5 had in-built instructions to make pictures effects, here is my solution for
blur effects (and others...) with php4 :
1 - (unzip and) add the attached file in your
includes directory :
2 - Replace the code in
thumb.php by this one:
<?php
define("ROOT_PATH", "./");
include("config.php");
include(ROOT_PATH."includes/constants.php");
if(!function_exists('file_get_contents'))
{
function file_get_contents($file)
{
$file = file($file);
return !$file ? false : implode('', $file);
}
}
if (isset($_GET['file']) && !empty($_GET['file']))
{
$file = THUMB_DIR."/".urldecode($_GET['file']);
if (isset($_GET['folder'])) $folder = $_GET['folder'];
if (file_exists($file)) {
// echo "yes : ".$file." exists<br>";
$etag = crc32($folder.$file);
//echo $etag."<br>";
$info = @getimagesize($file);
$modified = ($modified) ? $modified : gmdate('D, d M Y H:i:s', filemtime($file)).' GMT';
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && ($_SERVER['HTTP_IF_MODIFIED_SINCE'] == $modified || substr($_SERVER['HTTP_IF_MODIFIED_SINCE'],0,(strlen($_SERVER['HTTP_IF_MODIFIED_SINCE'])-strlen(strrchr($_SERVER['HTTP_IF_MODIFIED_SINCE'],";")))) == $modified) && (!isset($_SERVER['HTTP_IF_NONE_MATCH']) || empty($_SERVER['HTTP_IF_NONE_MATCH']) || $_SERVER['HTTP_IF_NONE_MATCH'] == '"'.$etag.'"'))
{
header("HTTP/1.1 304 Not Modified");
header("ETag: \"".$etag."\"");
exit;
}
include(ROOT_PATH."includes/class.imagefilter.php"); //--- incguding a class for pictures effects
$image = new ImageFilter;
$image->loadImage($file);
//$image->mosaic(2);
//$image->colorize(10, 1, 1, 1)
//$image->lightContrast(0, 100);
$image->lightContrast(100, 50);
//$image->Contrast();
$image->blur(2);
$image->blur();
//echo $etag."<br>";
//$image->lightContrast(0, 100);
//$image->blur();
//$image->mosaic(3);
//$image->sepia();
header("Last-Modified: " . $modified);
$image->output('JPEG');
exit;
}
}
header("HTTP/1.1 404 Not Found");
exit;
?>
as you can see, you can apply many other effects : read the
class.imagefilter.php file to get the complete effect list.
try all of them with new parameters to fit your needs.
but as i said in one of last posts, it need some improvement... the var
folder can be use to choose the effect as original mod...