Пример #1
0
 * extend the the time limit so avoid time out
 */
set_time_limit(0);
/**
 * Load The Image From Source File
 */
$path = "../../src.jpg";
$image = tulipIP::loadImage($path);
/**
 * apply filters on copy of loaded image then save the result
 */
$dest = "./";
$mime = TIP_PNG;
// 1 - gray filter
$copy = tulipIP::gdClone($image);
tulipIP::gray($copy);
tulipIP::saveImage($dest, $copy, $mime, 'gray-filter');
imagedestroy($copy);
// 2 - negate filter
$copy = tulipIP::gdClone($image);
tulipIP::negate($copy);
tulipIP::saveImage($dest, $copy, $mime, 'negate-filter');
imagedestroy($copy);
// 3 - Gaussian Blur filter where level in range (0,100)
$copy = tulipIP::gdClone($image);
tulipIP::Gblur($copy, 15);
tulipIP::saveImage($dest, $copy, $mime, 'Gblur-filter');
imagedestroy($copy);
// 4 - Brightness filter where level in range (-255,255)
$copy = tulipIP::gdClone($image);
tulipIP::brightness($copy, -100);
Пример #2
0
 *                  if false : tulipIP will write errors to exist log file
 *
 */
tulipIP::log(true, true);
/**
 * Load Image from source File
 * return gd resource in success false otherwise
 */
$path = "../../src.jpg";
$img = tulipIP::loadImage($path);
/**
 * Here We use tuliIP gray filter on loaded img
 * return true on success false otherwise
 */
if ($img) {
    $result = tulipIP::gray($img);
} else {
    echo "Unable To Load The Image";
}
/**
 * finally we save imag to directory and show the result in the browser
 *
 * Note : pass (null) as dest argument to output the image directly in the browser
 * ======
 * Note : you can change the outputted image format using one of
 * ====== supported tuliIP formats -> TIP_JPG , TIP_JPEG , TIP_PNG , TIP_GIF
 *
 * Important : Do Not Use TIP_JPG as content type when you send Header this
 * =========== will cause problems in (Safari) and (IE) browsers
 *             use TIP_JPEG instead 
 *