( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ
<?php
include("includes/limittext.php");
include('Connections/videoondemand.php');
require("DbSql.inc.php");
require("NewsSql.inc.php");
$db = new NewsSQL($DBName);
/*error_reporting(0);
set_time_limit(0) ;*/
function filter($arr) {
global $link;
return array_map(array($link, 'real_escape_string'), $arr);
}
/*
https://maps.googleapis.com/maps/api/staticmap?center=NAKURU&zoom=13&size=600x600&maptype=hybrid
http://localhost/mimix/brandX.php?AppNo=254722407698&mag=yes&gratitude=posted&filter=mood&nani=254722407699&cl=rightnow&pic=0fbfb36bad36a37e22955b2081eac3036SAMCOM2011DAY3-051.jpg*/
$_GET = filter($_GET);
$_POST = filter($_POST);
$mode=$_GET["mode"];
include("protect.php");
if (empty($page)) {
$page = 0;
}
include("includes/processFunctions.php");
require 'elementsMachine/textStyles/texttoImage.php';
$obj = new TextToImage();
if (empty($_GET['text']))
{
$text = dummyText();
}
else
{
$theText= $_GET["text"];
}
$route=$_GET["route"];
$action=$_GET["action"];
$fontid="themeid";
$myfont="layerid";
$layerid= $_GET["layerid"];
$fontcatalogid= $_GET["fontcatalogid"];
$themeid= $_GET["themeid"];
$font_Username= $_GET["font_Username"];
$font_Name= $_GET["font_Name"];
$font_Url= $_GET["font_Url"];
$font_Text= $_GET["font_Text"];
$text_w= $_GET["text_w"];
$text_h= $_GET["text_h"];
/*$text_w= 600;*/
/*$text_h= 0;*/
/*if (empty($_GET['pichaNi']))
{
$text_w= 600;
$text_h= 0;
} */
$text_x= $_GET["text_x"];
$text_y= $_GET["text_y"];
$text_align= $_GET["text_align"];
$text_size= $_GET["text_size"];
$text_color= "#".$_GET["text_color"];
$url_color= $_GET["url_color"];
$name_color= $_GET["name_color"];
$username_color= $_GET["username_color"];
$url_size= $_GET["url_size"];
$name_size= $_GET["name_size"];
$username_size= $_GET["username_size"];
$text_pad= $_GET["text_pad"];
$saveImage= $_GET["saveImage"];
$theText = htmlentities($theText);
$theText= $_GET["text"];
if ($theText == "rectFunc")
{
$text =$_GET['text'];
$hex = str_replace("#", "", $text_color);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
// example1.php
// set the HTTP header type to PNG
header("Content-type: image/png");
// set the width and height of the new image in pixels
$text_w= $_GET["text_w"];
$text_h= $_GET["text_h"];
// create a pointer to a new true colour image
$im = ImageCreateTrueColor($text_w, $text_h);
// sets background to red
$red = ImageColorAllocate($im,$r, $g, $b);
ImageFillToBorder($im, 0, 0, $red, $red);
// send the new PNG image to the browser
ImagePNG($im);
// destroy the reference pointer to the image in memory to free up resources
ImageDestroy($im);
exit();
}
if($theText == "timeFunc")
{
$date =date('H:i');
$theText = $date;
}
if($theText == "dayFunc")
{
$date =date('d/m/Y ');
$theText = $date;
}
if($theText == "randomFunc")
{
$rand =rand(11111111,99999999);
$theText = $rand;
}
$theText = str_replace('%92', '%27', $theText);
$text_line_height= $_GET["text_line_height"];
if (empty($_GET['S']))
{
$obj->saveImage(0);
}
else
{
$obj->saveImage(1);
}
if (!empty($_GET['S']))
{
$themeid = $_GET["themeid"];
$position = $_GET["position"];
$resultLayers = $db->getlayerDetails($themeid,$position);
$name = $resultLayers[0]["name"];
$layertype = $resultLayers[0]["layertype"];
$catalogid = $resultLayers[0]["catalogid"];
$themeid = $resultLayers[0]["themeid"];
$position = $resultLayers[0]["position"];
$layerw = $resultLayers[0]["layerw"];
$layerh = $resultLayers[0]["layerh"];
$layerx = $resultLayers[0]["layerx"];
$layery = $resultLayers[0]["layery"];
$layerr = $resultLayers[0]["layerr"];
$layeropacity = $resultLayers[0]["layeropacity"];
$layerflipv = $resultLayers[0]["layerflipv"];
$layerfliph = $resultLayers[0]["layerfliph"];
if (strpos($name, 'route=theUrl') !== false || strpos($name, 'route=theName') !== false || strpos($name, 'route=theUser') !== false )
{
$text_pad = 0;
}
if (!empty($_GET['position']) && !empty($_GET['type']))
{
$text_pad = $text_pad+30;
$text_size = $text_size ;
$text_w = 600;
}
}
$obj->setText($theText);
$obj->setFontSize($text_size);
$obj->setLineHeight($text_line_height);
$route= $_GET["route"];
if ($route=='theUrl')
{
$type = "Url";$column = "font";
}
if ($route=='theName')
{
$type = "Name";$column = "font";
}
if ($route=='theUpdate')
{
$type = "Caption";$column = "font";
}
if ($route=='theUser')
{/*
$themeid = $db -> base64url_decode($themeid);exit($themeid);*/
$type = "User";$column = "font";
}
$fontLayer = $db -> checkLayer($type,$column,$fontcatalogid,$themeid);
if (!empty($fontLayer))
{
$obj->setFontFile("assets/newfont/".$fontLayer);
}
else
{
$obj->setFontFile("assets/fonts/".$font_Text);
}
$obj->setUnderline(0);
$obj->setPadding($text_pad);
$obj->setHAlignment(strtolower($text_align)); // left, right, center
$obj->setWidth($text_w);
$obj->setRectangle(200);
/*$obj->setHeight(0);*/ //0 for auto
$obj->setHeight($text_h);
$obj->sety($text_y);
$obj->setAngle(0);
$obj->setStrokeWidth(1);
$obj->setStrokeColor(array(0, 0, 0));
$obj->setFontColor('#'.$text_color); // Hash value
$obj->setBackgroundColor('transparent'); // Hash value
$obj->draw();?>