( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php include("includes/limittext.php");
include('Connections/videoondemand.php');
require("DbSql.inc.php");
require("NewsSql.inc.php");
$db = new NewsSQL($DBName);
function filter($arr) {
global $link;
return array_map(array($link, 'real_escape_string'), $arr);
}
$image_path = 'v/uploads/gthumbs/' . $_GET['image'];
$save_image_path = 'v/uploads/raw/' . $_GET['image'];
$_GET = filter($_GET);
$_POST = filter($_POST);
$mode=$_GET["mode"];
include("protect.php");
if (empty($page)) {
$page = 0;
}
if (!empty($_GET['action'])) {
require_once('gd2imaging.php');
$action = $_GET['action'];
$value = $_GET['value'];
$finish =$_GET['finish'];
if ($action=="rotate")
{
if (empty($value))
{
$value =0;
}
$background = new Image($image_path);
$background->rotate($value);
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="noise")
{
$background = new Image($image_path);
$background->useMedian();
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="pastel")
{
$background = new Image($image_path);
$background->useMedian(7, 7);
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="hue")
{
if (empty($value))
{
$value = 180;
}
$background = new Image($image_path);
$background->setHue($value); // 180 degrees
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="hue2")
{
if (empty($value))
{
$value = 90;
}
$background = new Image($image_path);
$background->setHue($value); // 180 degrees
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="hue3")
{
if (empty($value))
{
$value = -90;
}
$background = new Image($image_path);
$background->setHue($value); // 180 degrees
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="hue4")
{
if (empty($value))
{
$value = -180;
}
$background = new Image($image_path);
$background->setHue($value); // 180 degrees
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="hue5")
{
if (empty($value))
{
$value = -100;
}
$background = new Image($image_path);
$background->setHue($value); // 180 degrees
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="hue6")
{
if (empty($value))
{
$value = 20;
}
$background = new Image($image_path);
$background->setHue($value); // 180 degrees
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="hue7")
{
if (empty($value))
{
$value = 45;
}
$background = new Image($image_path);
$background->setHue($value); // 180 degrees
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="hue8")
{
if (empty($value))
{
$value = -45;
}
$background = new Image($image_path);
$background->setHue($value); // 180 degrees
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();
}
if ($action=="vibrance")
{
if (empty($value))
{
$value = 1.1;
}
$background = new Image($image_path);
// Luminance set to 140%
$background->setLuminance(1.4);
// Color saturation set to 220%
$background->setSaturation($value);
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();;
}
if ($action=="vibrance2")
{
if (empty($value))
{
$value = -0.9;
}
$background = new Image($image_path);
// Luminance set to 140%
$background->setLuminance(1.6);
// Color saturation set to 220%
$background->setSaturation($value);
if ($finish) {
$background->saveAsJpeg($save_image_path);
$db->mag6($_GET['image']);
}
$background->show();;
}
if ($action=="background")
{
$background = new Image($image_path);
$background->getBackgroundColor();
}
if ($action=="ocr")
{
// load an image with a reference alphabet characters
$charsImage = new Image('examples/alphabet.png');
// set size of the reference characters
$charSize = new Dimensions(26, 25);
// create the quantizator
$quantizator = new Quantizator();
foreach(range('A', 'Z') as $index => $char) {
// fetch an image of the given character
$charImage = $charsImage->getSubImage(new Point($index * 26, 0), $charSize);
// add vector to the glyphs collection
$quantizator->addGlyph($charImage->getVector(), $char);
}
// load an image with text to read
$background = new Image($image_path);
$text = '';
$lastObject = null;
// try to find all objects(letters) in the image.
foreach($background->findObjects() as $object) {
// find spaces...
if($lastObject && $object->getPosition()->x - $lastObject->getPosition()->x > $object->getDimensions()->width * 1.5) {
$text .= ' ';
}
$lastObject = $object;
$search = $object->resize($charSize)->getVector();
$result = $quantizator->findNearestEuklid($search);
$text .= $result[0];
}
echo 'Found: <strong>'.$text.'</strong><br>';
}
if ($action=="captcha")
{
$background = new Image($image_path);
// set size of the reference characters
$charSize = new Dimensions(26, 25);
// create the quantizator
$quantizator = new Quantizator();
foreach(array_merge(range('A', 'Z'), range(1, 9)) as $index => $char) {
// fetch an image of the given character
$charImage = $charsImage->getSubImage(new Point($index * 26, 0), $charSize);
// add vector to the glyphs collection
$quantizator->addGlyph($charImage->getVector(), $char);
}
// load captcha text to read
$background = new Image('examples/captcha.gif');
// invert colors, remove captcha noise
$background->toNegative()->useMedian();
$text = '';
$lastObject = null;
// try to find all letters and numbers in the captcha.
foreach($background->findObjects() as $object) {
$lastObject = $object;
$search = $object->resize($charSize)->getVector();
$result = $quantizator->findNearestEuklid($search);
$text .= $result[0];
}
echo 'Captcha: <strong>'.$text.'</strong><br>';
}
exit();
}?>