( ′∀`)σ≡σ☆))Д′)レ(゚∀゚;)ヘ=З=З=Зε≡(ノ´_ゝ`)ノ HEX
HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux mail.thebrand.ai 6.8.0-107-generic #107-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 13 19:51:50 UTC 2026 x86_64
User: www-data (33)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/www/html/tmpr/../tmpr/../tmpr/../tmpr/..//displayKing.php
<?php
error_reporting(0);include("includes/limittext.php");
include('Connections/videoondemand.php');  
require("DbSql.inc.php");
require("NewsSql.inc.php");

$db = new NewsSQL($DBName); 

/*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;
}



/*$url = "https://maps.googleapis.com/maps/api/staticmap?center=NAKURU&zoom=13&size=600x600&maptype=hybrid";
$resource = imagecreatefromstring(file_get_contents($url));
$img = imagecreatetruecolor($w*$size,$h*$size);*/

function removeslashes($string)
{
    $string=implode("",explode("\\",$string));
    return stripslashes(trim($string));
}
 
function findSharp($orig, $final) 
{
	$final	= $final * (750.0 / $orig);
	$a		= 52;
	$b		= -0.27810650887573124;
	$c		= .00047337278106508946;
	
	$result = $a + $b * $final + $c * $final * $final;
	
	return max(round($result), 0);
} // findSharp()
 


/** Apply a PNG overlay */
function gd_apply_effect($background, $brand, $amount)
{

if ($_GET['action']=="cards")
		
		 {
			 $width = 640;  $height = 430;	
				
					 
		 
		 }
		 else
		 
		 {
			   if (!empty($_GET['description']))
		
		 {
			 $width = 640;  $height = 400;	 
		 }
		 else
		 
		 {
			  $width = 600;  $height = 666;	
		 }
		 
		 }
	


	// Get the size and MIME type of the requested image
/*$size	= GetImageSize($docRoot . $image);
$mime	= $size['mime'];*/
 

 
	$photoFrame2 = imagecreatetruecolor($width, $height);
	
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 
	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$mag = $brand;
	
 
		
 
 
		$brand = 'filters/effects/' . $brand . '.png';
		$photo2 = imagecreatefrompng($brand);
		 
	
	
	/*include("mags/switch.php"); */
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
/** Apply a PNG overlay */
/** Apply a PNG overlay */
function gd_apply_overlay($background, $brand, $amount)
{

if ($_GET['action']=="cards")
		
		 {
			 $width = 640;  $height = 430;	
				
					 
		 
		 }
		 else
		 
		 {
			   if (!empty($_GET['description']))
		
		 {
			 $width = 640;  $height = 400;	 
		 }
		 else
		 
		 {
			  $width = 600;  $height = 666;	
		 }
		 
		 }
	


	// Get the size and MIME type of the requested image
/*$size	= GetImageSize($docRoot . $image);
$mime	= $size['mime'];*/
 

 
	$photoFrame2 = imagecreatetruecolor($width, $height);
	
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 
	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$mag = $brand;
	
 
		
 
 
		$brand = 'filters/mood/' . $brand . '.png';
		$photo2 = imagecreatefrompng($brand);
		 
	
	
	/*include("mags/switch.php"); */
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
/** Apply a PNG overlay */


function gd_apply_logo($background, $brand, $amount,$x,$y,$w,$h)
{

$width = 600;  $height = 600;	

	// Get the size and MIME type of the requested image
/*$size	= GetImageSize($docRoot . $image);
$mime	= $size['mime'];*/
 

 
	$photoFrame2 = imagecreatetruecolor($width, $height);
	
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 
	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$mag = $brand;
	
 
		
 
 
		$brand = 'v/uploads/raw/' . $brand;
		$photo2 = imagecreatefromjpeg($brand);
		 
	
	
	/*include("mags/switch.php"); */
	imagecopyresampled($photoFrame2, $photo2, $x, $y, 0,0, $w, $h, $width, $height);
	
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
/** Apply a PNG overlay */
 
 
 /** Apply a PNG overlay */
function gd_apply_overlay2($background, $brand, $amount,$x,$y)
{

 
		 $picture = explode('.',$brand);
         $ext = strtolower($picture[1]);
		 
	switch ($ext)
{
	case 'gif':
		// We will be converting GIFs to PNGs to avoid transparency issues when resizing GIFs
		// This is maybe not the ideal solution, but IE6 can suck it
		$creationFunction	= 'ImageCreateFromGif';
		$outputFunction		= 'ImagePng';
		$mime				= 'image/png'; // We need to convert GIFs to PNGs
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // We are converting the GIF to a PNG and PNG needs a compression level of 0 (no compression) through 9
	break;
	
	case 'png':
	
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
	break;
	
	default:
		$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;
	break;
}	 
 
 	$width =600;$height =600;
	$photoFrame2 = imagecreatetruecolor($width, $height);
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$brand = 'v/uploads/raw/' . $brand . '';
	$photo2 = $creationFunction($brand);
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 

	
	return $background;
}

function gd_apply_overlay4($background, $brand, $amount)
{


$picture = explode('.',$brand);
         $ext = strtolower($picture[1]);
		 
	switch ($ext)
{
	case 'gif':
		// We will be converting GIFs to PNGs to avoid transparency issues when resizing GIFs
		// This is maybe not the ideal solution, but IE6 can suck it
		$creationFunction	= 'ImageCreateFromGif';
		$outputFunction		= 'ImagePng';
		$mime				= 'image/png'; // We need to convert GIFs to PNGs
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // We are converting the GIF to a PNG and PNG needs a compression level of 0 (no compression) through 9
	break;
	
	case 'png':
	
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
	break;
	
	default:
		$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;
	break;
}	 
 	$width =600;$height =600;
	$photoFrame2 = imagecreatetruecolor($width, $height);
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$brand = 'v/uploads/raw/' . $brand . '';
	$photo2 = $creationFunction($brand);
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
 function gd_apply_overlay6($background, $brand, $amount)
{


$picture = explode('.',$brand);
         $ext = strtolower($picture[1]);
		 
	switch ($ext)
{
	case 'gif':
		// We will be converting GIFs to PNGs to avoid transparency issues when resizing GIFs
		// This is maybe not the ideal solution, but IE6 can suck it
		$creationFunction	= 'ImageCreateFromGif';
		$outputFunction		= 'ImagePng';
		$mime				= 'image/png'; // We need to convert GIFs to PNGs
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // We are converting the GIF to a PNG and PNG needs a compression level of 0 (no compression) through 9
	break;
	
	case 'png':
	
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$doSharpen			= FALSE;
		$quality			= round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
	break;
	
	default:
		$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$doSharpen			= FALSE;
	break;
}	 
 	$width =600;$height =600;
	$photoFrame2 = imagecreatetruecolor($width, $height);
	imagealphablending($photoFrame2, false);
	imagesavealpha($photoFrame2, true);
 	$trans_colour = imagecolorallocatealpha($photoFrame2,  0, 0, 0, 127);
	imagefilledrectangle($photoFrame2, 0, 0, $width, $height, $trans_colour);
	$brand = 'brands/' . $brand . '';
	$photo2 = $creationFunction($brand);
	imagecopyresampled($photoFrame2, $photo2, 0, 0, 0,0, $width, $height, $width, $height);
	$photoFrame = imagecreatetruecolor($width, $height);
	imagecopy($photoFrame, $background, 0, 0, 0, 0, $width, $height);
	imagecopy($photoFrame, $photoFrame2, 0, 0, 0, 0, $width, $height);
	imagecopymerge($background, $photoFrame, 0, 0, 0, 0, $width, $height, $amount); 
	imagedestroy($photoFrame); 
	
	return $background;
}
/** Apply a PNG overlay */
function hex_to_rgb($hex) {
    // remove '#'
    if(substr($hex,0,1) == '#')
        $hex = substr($hex,1) ;

    // expand short form ('fff') color to long form ('ffffff')
    if(strlen($hex) == 3) {
        $hex = substr($hex,0,1) . substr($hex,0,1) .
               substr($hex,1,1) . substr($hex,1,1) .
               substr($hex,2,1) . substr($hex,2,1) ;
    }

    if(strlen($hex) != 6)
        fatal_error('Error: Invalid color "'.$hex.'"') ;

    // convert from hexidecimal number systems
    $rgb['red'] = hexdec(substr($hex,0,2)) ;
    $rgb['green'] = hexdec(substr($hex,2,2)) ;
    $rgb['blue'] = hexdec(substr($hex,4,2)) ;

    return $rgb ;
}


function fatal_error($message)
{
    // send an image
    if(function_exists('ImageCreate'))
    {
        $width = ImageFontWidth(5) * strlen($message) + 10 ;
        $height = ImageFontHeight(5) + 10 ;
        if($image = ImageCreate($width,$height))
        {
            $background = ImageColorAllocate($image,255,255,255) ;
            $text_color = ImageColorAllocate($image,0,0,0) ;
            ImageString($image,5,5,5,$message,$text_color) ;
            header('Content-type: image/png') ;
            ImagePNG($image) ;
            ImageDestroy($image) ;
            exit ;
        }
    }

    // send 500 code
    header("HTTP/1.0 500 Internal Server Error") ;
    print($message) ;
    exit ;
}
/*if(!$image || !$box)
{
    fatal_error('Error: The server could not create this image.') ;
}
*/ 
 function dummyText()
{
	
	$message = $_GET['context'];
	$text = "$message *".$_GET['cl']; 
	
	
		 
	  return $text;
	  } 
	  
	   function realText()
{
	 $text = mysqli_real_escape_string($link,$_GET['context']) ;  
	$text  = removeslashes($text);	
	return $text;
	  }
 function username()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 
	  $un = strtolower($row_settings['user_name']);
	  
	return removeslashes($un);	
	  
	 } }

 function user()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 
	   $ca =  $row_settings['catalogname'] ;
	  return removeslashes($ca);	
	 } }

 function yanani($yanani)
{
	 
 $rs_settings = mysqli_query($link,"select * from users where catalogid=$yanani"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 
	  $user_name = strtolower($row_settings['user_name']);
	  return removeslashes($user_name);
	  
	 } }
 function slug()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 
	  return $slug = strtolower($row_settings['slug']);
	  
	 } }

 function bio()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
			 $description = strtolower($row_settings['description']);
			 if(empty($description)){ $description=  "Visit startag.co/".$row_settings['user_name']." for updates";} 
			 else{
				 $description = strtolower($row_settings['description']);
				 }
		 
	  
	  return  removeslashes($description);
	  
	 } }


 function profilepicture()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from profilepicture where catalogid=$nani and type='1' limit 0,1"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 
	  return $picture = strtolower($row_settings['picture']);
	  
	 } }

 function findStartag($startag)
{
 	$rs_settings = mysqli_query($link,"select * from profilepicture where title='$startag' limit 0,1"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 $id = $row_settings['id'];
		 $yanani = $row_settings['catalogid'];
		 $nani = $_GET['nani'];
		 if($nani!=$yanani)
		 {
			 $viewnum = $row_settings['viewnum'];
		 $viewnum = $viewnum+1;
		 mysqli_query("update profilepicture set viewnum=$viewnum where id='$id'");  
			 
			 
			 }
		
		 $picture = explode('.',$row_settings['picture']);
         $picture = $picture[0];
		 $picture = $row_settings['picture'];
		 $theme = $row_settings['description'];
		 $overlay = $row_settings['overlay'];
		 $yanani = $row_settings['catalogid'];
		 $fx = $row_settings['fx'];
		 $x = $row_settings['x'];
		 $y = $row_settings['y'];
	  return $picture."|".$theme."|".$overlay."|".$yanani."|".$x."|".$y."|".$fx."|";
	  
	 } }

 function openGallery($startag)
{
 	$rs_settings = mysqli_query($link,"select * from profilepicture where title='$startag' and type=3  limit 0,1"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 $id = $row_settings['id'];
		 $yanani = $row_settings['catalogid'];
		 $nani = $_GET['nani'];
		 if($nani!=$yanani)
		 {
			 $viewnum = $row_settings['viewnum'];
		 $viewnum = $viewnum+1;
		 mysqli_query("update profilepicture set viewnum=$viewnum where id='$id'");  
			 
			 
			 }
		
		 $picture = explode('.',$row_settings['picture']);
         $picture = $picture[0];
         $picture = $row_settings['picture'];
		 $theme = $row_settings['description'];
		 $overlay = $row_settings['overlay'];
		 $yanani = $row_settings['catalogid'];
		 $fx = $row_settings['fx'];
		 $x = $row_settings['x'];
		 $y = $row_settings['y'];
	  return $picture."|".$theme."|".$overlay."|".$yanani."|".$x."|".$y."|".$fx."|";
	  
	 } }

 function AppOwner()
{
	$AppNo = $_GET['AppNo']; 
	 
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$AppNo"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 
		  return $cat = strtolower($row_settings['catalogname']);
	  
	 } }
	 function country()
{
	$nani = $_SESSION["user"]; 
	
	if(!empty($_GET['nani']))
	{
	$nani = $_GET['nani']; 	
	 
	
	}
	
	
 	$rs_settings = mysqli_query($link,"select * from users where catalogid=$nani"); 
		 while ($row_settings = mysql_fetch_array($rs_settings)) {
		 
	  return $country = strtolower($row_settings['country']);
	  
	 } }
	  

if ($_GET['gratitude'] == "start")  {
$uploaddir = 'v/uploads/raw/';
$image ="images/gratitude.jpg";
$date	= md5(date('D, d M Y H:i:s'));
$upload =  $date.basename($image);

$uploadfile = $uploaddir .$upload; 

 copy($image,$uploadfile);
 
 $user      = user();
$owner     = AppOwner();
 $AppNo = $_GET['AppNo'];
 $nani = $_GET['nani'];


$db->addgratitude($user,$owner,$AppNo,$nani,$upload);
$pic = $upload;
 
}	 
	 
	

 
 
 function showUpdate($nani) 
	{

/*error_reporting(0);*/
include_once 'real/service/social/includes/tolink.php';
include_once 'real/service/social/includes/textlink.php';
include_once 'real/service/social/includes/htmlcode.php';
include_once 'real/service/social/includes/Expand_URL.php';
require("const.inc.php");   
 $newquery = mysqli_query("SELECT M.msg_id, M.newsid, M.catalogid_fk, M.original,M.isdisplay,M.episodeid,M.yanani, M.message, M.created, U.user_name,U.slug,M.uploads,M.type, U.user_name FROM reporta M, users U where M.catalogid_fk=U.catalogid and M.catalogid_fk='$nani' order by M.msg_id desc limit 1 ");
  $data = mysql_fetch_array($newquery);
		



if($data)
{
	 $url=$data['message']; 
$returns = 'none';
if(eregi("youtu",$url) or eregi("youtube",$url)){
        if(eregi("v=",$url))
    $splits = explode("=",$url);
    else
    $splits = explode("be/",$url);

        if(!empty($splits[1])){
			if(preg_match("/feature/i", $splits[1])){
			$splits[1] = str_replace("&feature","",$splits[1]);	
			}
                $returns = '<iframe width="100%" height="400" src="http://www.youtube.com/embed/'.$splits[1].'" frameborder="0"></iframe>';
        }
} else if(eregi("vimeo",$url)){
        $splits = explode("com/",$url);
        $returns = '<iframe src="http://player.vimeo.com/video/'.$splits[1].'?title=0&amp;byline=0&amp;portrait=0" width="100%" height="400" frameborder="0"></iframe>';
}
	
	 
 $msg_id=$data['msg_id'];
 $orimessage=$data['message'];

 $message=$db-> $data['message'] ; 
 $message= preg_replace('/\*(\\w+)/', "",$message );
 $message=tolink(htmlcode($message));
 
  $time=$data['created'];  $msg_created=$data['created'];
$mtime=date("c", $time);
  $user_name=$data['user_name'];
 $profile=$data['slug'];
  $uploads=$data['uploads'];
 $msg_catalogid=$data['catalogid_fk'];
$msg_yanani=$data['yanani'];
  $msg_slug=$data['slug'];
  $msg_slug=$data['slug'];
  $nani=$data['type'];
  $photoDisplay=$data['original'];
  
$msg_newsid=$data['msg_id'];
  if($nani==13) { $msg_newsid=$data['newsid'];$msg_id=$data['newsid']; }
  $forChannel=$data['msg_id'];
    $forText=$data['msg_id'];
	 $forVideo=$data['msg_id'];
	 $forLove=$data['msg_id'];
   $msgidLove=$data['msg_id'];
	 $photoDisplay=$data['original'];
$isdisplay=$data['isdisplay'];
  $episodeid=$data['episodeid'];
$actualID=$data['msg_id'];
 
 
  if(!empty($_SESSION['TwitterUsername']))
		{
			include 'twitter/EpiTwitter/EpiCurl.php';
			include 'twitter/EpiTwitter/EpiOAuth.php';
			include 'twitter/EpiTwitter/EpiTwitter.php';
			include 'twitter/EpiTwitter/TwitterConfig.php';
			include("Connections/videoondemand.php");
			include("twitter/db.php");
			
			$message=mysql_real_escape_string($orimessage);
			 $message=stripslashes($message);
			$pic = " $siteaddress3/taswira.php?width=500&quality=70&image=/v/uploads/raw/$photoDisplay";  
 
 
			  $TwitterUsername=$_SESSION['TwitterUsername'];
			$tw_sql=mysqli_query($connection,"SELECT oauth_token,oauth_token_secret FROM users WHERE tel='$msg_catalogid'");
			$row=mysqli_fetch_array($tw_sql,MYSQLI_ASSOC);
			$oauth_token=$row["oauth_token"];
			$oauth_token_secret=$row["oauth_token_secret"];
			 
			$Twitter = new EpiTwitter($consumer_key, $consumer_secret);
			$Twitter->setToken($oauth_token,$oauth_token_secret);
			$status=$Twitter->post_statusesUpdate(array('status' => $message.$pic));
			/*echo $status->id_str;*/
			 
			}	
?>

<div class="col-lg-6 col-sm-6" style=" margin-top:-5px;  margin-bottom:0px; padding:0px ;   ">
  <section class="panel  picha<?php print $msg_id; ?> " id="stbody<?php echo $msg_id;?>" style=" background-color:#FFF; padding-bottom:18px ; padding:2px; padding-top:7px; overflow:hidden;-moz-border-radius : 0px;-webkit-border-radius :0px;border-radius : 0px;"   >
    <div class="panel-body photo2 " style="padding-top:0px; padding-left:0px; padding-right:0px; background:none ; background-color:#FFF " >
      <div class="pull-in bg-white clearfix m-b-n love2 love2<?php print $msg_id; ?>" rel="<?php print $msg_catalogid; ?>"  id="<?php print $msg_id; ?>" style="text-align:center; min-height:350px;background-repeat:no-repeat; background-size:100%; background-position:center; background-position:top; padding:0px;background-image:url(images/images/default3.png);"> <img src="<?php echo $siteaddress3 ?>taswira.php?width=500&quality=70&image=/v/uploads/raw/<?php echo $photoDisplay ?>" width="90%"  /> </div>
    </div>
  </section>
</div>

<?php
}			 
			 
      
       
    } 
 
 
 
 
 
 
 
 
 
 
 
 
	  	
	
 

 if ($_GET['gratitude'] == "posted")  {

if (!empty($_GET['context'])) 
{
 $text = realText();
}
else
{
	 $text = mysqli_real_escape_string($link,$_GET['cl']);
}
 
	
preg_match('/\>(\\w+)/',$_GET['context'],$vida);
$vida =$vida[1];
//is it video or not
//is it video or not
if ($vida  == "video") 
{ //it is video hurraaaay

include("mags/video.php"); 
exit();}



if ($vida != "video") 
{ //its not
$uploaddir = 'v/uploads/raw/';

$picture     = profilepicture();
if(!empty($picture)) 
{
	
	
					if(!empty($_GET["postDirect"])) 
				{
					$image ="v/uploads/raw/$picture";
				}
				else
				{
					$image ="v/uploads/raw/$picture";
					}
					
	
	
}
else
{
$picme = rand(1,10);
if($picme == 1) { $image ="images/backgrounds/bg-4.jpg"; } 
if($picme == 2) { $image ="images/backgrounds/bold.jpg";} 
if($picme == 3) { $image ="images/backgrounds/dusk.jpg"; } 
if($picme == 4) { $image ="images/backgrounds/bg-2.jpg"; } 
if($picme == 5) { $image ="images/backgrounds/bg-3.jpg"; } 
if($picme == 6) { $image ="images/backgrounds/frost.jpg"; } 
if($picme == 7) { $image ="images/backgrounds/sky.jpg";} 
if($picme == 8) { $image ="images/backgrounds/sunset.jpg"; } 
if($picme == 9) { $image ="images/backgrounds/sunset2.jpg"; } 
if($picme == 10) { $image ="images/backgrounds/sunset3.jpg"; }
$image ="images/backgrounds/sky.jpg"; 
} 
 

$date	= md5(time());
/*$upload =  $date.basename($image);*/
 
$upload =  $date.".jpg";
$uploadfile = $uploaddir .$upload; 



if (!empty($_GET['cl'])) { 
$pic =$_GET['pic'];
gd_filter_image('v/uploads/raw/' . $pic, $_GET['filter']); }
else
{
	copy($image,$uploadfile);
}
	
  

 $user      = user();
$owner     = AppOwner();
 $AppNo = mysqli_real_escape_string($link,$_GET['AppNo']);
 $nani = mysqli_real_escape_string($link,$_GET['nani']);
		
if (!empty($_GET['context'])) 
		{
		 $text = realText();
		 $text = str_replace("\n" , ' ',$context);
		  $text = str_replace("\r" , ' ',$context);
$uploads="";
 
/* $db->Insert_UpdateX($nani,$text,$uploads,$AppNo,$upload,$owner); */	
	
		}		
		
	if (!empty($_GET['cl'])) 
		{
		$text = dummyText(); 
		}		
			
	 
		
 
$pic = $upload;
 
} 
 


 
if ($pic && $_GET['filter']) {

 if (!empty($_GET['fire'])) {
 
	$AppNo = mysqli_real_escape_string($link,$_GET['AppNo']);
	$cl = mysqli_real_escape_string($link,$_GET['cl']);
	$overlay = mysqli_real_escape_string($link,$_GET['overlay']);
	$pic = $_GET['pic'];
	$x = $_GET['x'];
	$fx = $_GET['fx'];
	$mytitle = $_GET['mytitle'];
	$y = $_GET['y'];
	$msg_id = $_GET['msg_id'];
	$msg_id = $db->base64url_decode($msg_id);
	$mytitle = $_GET['mytitle'];
	$fx = $_GET['fx'];
	
	
	
	
	
	if(!empty($fx))
	{
 
 
		$db->mag8($pic,$fx,$msg_id,$ren);
		
	}
		else
	{
		$db->mag7($pic,$AppNo,$cl,$overlay,$mytitle,$x,$y,$msg_id);
		}



 
	}

		
 $mag = $_GET['mag'];	
 	$id = substr($pic, 5, 1);
	
	
	if (!empty($_GET['cl'])) { 
$pic =$_GET['pic'];
 
/*gd_filter_image($image, "blank"); */
gd_filter_image('v/uploads/raw/' . $pic, $_GET['filter']); }
else
{
	gd_filter_image('v/uploads/raw/' . $pic, $_GET['filter']);
}
	
	
	

 //end no vida
 }	 

}

/** Apply and deliver the image and clean up */
function gd_filter_image($image_path, $photoFrame2_name)
{



	
	$photoFrame2 = 'gd_filter_' . $photoFrame2_name;
	
 
		list($width, $height) = getimagesize($image_path);
		
		
		
		$size	= GetImageSize($image_path);
$mime	= $size['mime'];	 
if (substr($mime, 0, 6) != 'image/')
{
header("Location: ./indexAlone.php?mode=photos&msg=requested file is not an accepted type");
exit();
} 
 
  
$background = imagecreatetruecolor($width, $height);
	
	
	
	
	// Set up the appropriate image handling functions based on the original image's mime type
switch ($size['mime'])
{
	case 'image/gif':
		// We will be converting GIFs to PNGs to avoid transparency issues when resizing GIFs
		// This is maybe not the ideal solution, but IE6 can suck it
		$creationFunction	= 'ImageCreateFromGif';
		$outputFunction		= 'ImagePng';
		$mime				= 'image/png'; // We need to convert GIFs to PNGs
		$quality			= round(10 - ($quality / 10));
	/*	if (empty($_GET['execute'])) {$quality			= round(10 - (35 / 10));}*/
		
		 // We are converting the GIF to a PNG and PNG needs a compression level of 0 (no compression) through 9
	
	break;
	
	
	case 'image/png':
	$quality=100;
		$creationFunction	= 'ImageCreateFromPng';
		$outputFunction		= 'ImagePng';
		$quality			= round(10 - ($quality / 10)); // PNG needs a compression level of 0 (no compression) through 9
/*	if (empty($_GET['execute'])) {$quality			= round(10 - (35 / 10));}*/
	break;
	
	default:
		$creationFunction	= 'ImageCreateFromJpeg';
		$outputFunction	 	= 'ImageJpeg';
		$quality=100;
		/*	if (empty($_GET['execute'])) {$quality	 = 35;}*/
	
	break;
}
		
		
		
		$src = $creationFunction($image_path);
		
		
		
		
if (in_array($size['mime'], array('image/gif', 'image/png')))
{
 

	if (!$color)
	{
		// If this is a GIF or a PNG, we need to set up transparency
		imagealphablending($background, false);
		imagesavealpha($background, true);
	}
	else
	{
		// Fill the background with the specified color for matting purposes
		if ($color[0] == '#')
			$color = substr($color, 1);
 
		$background	= FALSE;
		
		if (strlen($color) == 6)
			$background	= imagecolorallocate($background, hexdec($color[0].$color[1]), hexdec($color[2].$color[3]), hexdec($color[4].$color[5]));
		else if (strlen($color) == 3)
			$background	= imagecolorallocate($background, hexdec($color[0].$color[0]), hexdec($color[1].$color[1]), hexdec($color[2].$color[2]));
		if ($background)
			imagefill($background, 0, 0, $background);
	}
}

$x = $_GET['x'];
$y = $_GET['y'];
if(($x !=0) ||($y !=0)) {
$x = $_GET['x'];
$y = $_GET['y'];
} 

	
	
	
	
	
		$zoom = $_GET['zoom'];
		if (empty($zoom)) 
				{ 
				$zoomheight = $height; 
				$zoomwidth = $width; 
				}
		 else {
			  $zoomheight =  $height + $zoom ;
			  $zoomwidth =  $width + $zoom ;
			  
				}
 
		
		imagecopyresampled($background, $src, 0, 0, $x, $y, $zoomwidth, $zoomheight, $width, $height);

	$background = $photoFrame2($background);
		if (!empty($_GET['output'])) {
			$outputFunction($background, $image_path, $quality);
				 $nani = $_GET['nani'];
	 showUpdate($nani);
	 exit();
	} 
	
	if (!empty($_GET['execute'])) {
		
		$AppNo= $_GET['AppNo'];
		
		$context = $_GET['context'];
		
		$nani =$_GET['nani'];
		
		$pic=$_GET['pic'];
		
		
		$uploads ="";
	 
	 $user      = user();
$owner     = AppOwner();
 $AppNo = mysqli_real_escape_string($link,$_GET['AppNo']);
 $nani = mysqli_real_escape_string($link,$_GET['nani']);
  $text = $_GET['context'];
  $pic = $_GET['pic'];
$uploads="";

$time=time();
	   $ip=$_SERVER['REMOTE_ADDR'];
	   $isdisplay = 15;
$query = mysqli_query("SELECT msg_id,message FROM `reporta` WHERE catalogid_fk='$nani' order by msg_id desc limit 1") or die(mysql_error());
        $result = mysql_fetch_array($query);
		
        if ($text!=$result['message']) {
			
				   
 $query = mysqli_query("INSERT INTO `reporta` (message,original, catalogid_fk,type,ip,created,appno,filter,isdisplay,yanani) VALUES (N'$text', '$pic', '$nani','6','$ip','$time','$AppNo','elated','$isdisplay','$nani')") or die(mysql_error());	
		
  
 
	$outputFunction($background, $image_path, $quality);	
	}
	
	
	} 

	
	 if (!empty($_GET['fire'])) {
	 
	 $imageX = "v/uploads/raw/".$_GET['pic'];
	  
	 
	$outputFunction($background, $imageX, $quality);
	}
	
	
	 
	header("Content-type: $mime");
	$outputFunction($background, null, $quality);
		 
		imagedestroy($background);
		imagedestroy($src);
	 
}



function imagettftextSp($background, $size, $angle, $x, $y, $color, $font, $text, $spacing = 0)
{        
    if ($spacing == 0)
    {
       return  imagettftext($background, $size, $angle, $x, $y, $color, $font, $text);
    }
    else
    {
        $temp_x = $x;
        for ($i = 0; $i < strlen($text); $i++)
        {
            return  imagettftext($background, $size, $angle, $temp_x, $y, $color, $font, $text[$i]);
            $temp_x += $spacing + ($bbox[2] - $bbox[0]);
        }
    }
}



function gd_filter_mood($background)
{
	
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
$text = stripslashes($text) ; 
$text = nl2br(htmlentities($text, ENT_QUOTES, 'UTF-8'));
$text = preg_replace('/\s+/', ' ', trim($text));
	 
 
preg_match('/\*(\\w+)/',$text,$matches);
 $moods =$matches[1];
 $moods =strtolower($moods); 
   
  switch ($moods) {
	  case  "widgetstats" :
        $background= gd_filter_widget($background);
		return $background;
        break;
		 case  "widgetstats2" :
         $background= gd_filter_widget($background);
		return $background;
        break;
		 case  "widgetstats" :
         $background= gd_filter_widget($background);
		return $background;
        break;
		 case  "widgetblue" :
         $background= gd_filter_widget($background);
		return $background;
        break;
		 case  "widgetred" :
        $background= gd_filter_widget($background);
		return $background;
        break;
		 case  "widgetgreen" :
         $background= gd_filter_widget($background);
		return $background;
        break;
		   case  "classic" :
        $background= gd_filter_classic($background);
		return $background;
        break;
		case  "royal" :
        $background= gd_filter_royal($background);
		return $background;
        break;
		case  "yellow" :
        $background= gd_filter_yellow($background);
		return $background;
        break;
		case  "coolpost" :
		$background= gd_filter_coolpost($background);
		return $background;
		break;
								  case  "glassy" :
								  $background= gd_filter_glassy($background);
								  return $background;
								  break;
								  case  "followme" :
								  $background= gd_filter_followme($background);
								  return $background;
								  break;
								  case  "orange" :
								  $background= gd_filter_orange($background);
								  return $background;
								  break;
		case  "green" :
        $background= gd_filter_yellow($background);
		return $background;
        break;
		  
		 case  "blue" :
        $background= gd_filter_yellow($background);
		return $background;
        break;
		 case  "red" :
        $background= gd_filter_yellow($background);
		return $background;
        break;
			 case  "purple" :
        $background= gd_filter_yellow($background);
		return $background;
        break;
			 case  "pink" :
        $background= gd_filter_yellow($background);
		return $background;
        break;

								  case  "modernyellow" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
								  case  "moderngreen" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									
								   case  "modernblue" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
								   case  "modernred" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									   case  "modernpurple" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									   case  "modernpink" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;



								  case  "shangwemtaani" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
								  case  "teammafisi" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
									
								   case  "thisisforyou" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
								   case  "mpesa" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
									   case  "suzziemaselfie" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
									   case  "safaricomcare" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
								  
								  
								  
								  case  "gaasimple" :
								  $background= gd_filter_gaame($background);
								  return $background;
								  break;
								  case  "gaasocial" :
								  $background= gd_filter_gaame($background);
								  return $background;
								  break;
									
								   case  "gaaclean" :
								  $background= gd_filter_gaame($background);
								  return $background;
								  break;
								   case  "gaacool" :
								  $background= gd_filter_gaame($background);
								  return $background;
								  break;
									   case  "gaa5" :
								  $background= gd_filter_gaame($background);
								  return $background;
								  break;
									   case  "gaa6" :
								  $background= gd_filter_gaame($background);
								  return $background;
								  break;





		 case  "calmgreen" :
        $background= gd_filter_calmgreen($background);
		return $background;
        break;
		 case  "calmyellow" :
        $background= gd_filter_calmgreen($background);
		return $background;
        break;
		 case  "calmblue" :
        $background= gd_filter_calmgreen($background);
		return $background;
        break;
		 case  "calmred" :
        $background= gd_filter_calmgreen($background);
		return $background;
        break;
			 case  "calmpurple" :
        $background= gd_filter_calmgreen($background);
		return $background;
        break;
			 case  "adgreen" :
        $background= gd_filter_adgreen($background);
		return $background;
        break;
		 case  "adyellow" :
        $background= gd_filter_adgreen($background);
		return $background;
        break;
		case  "adwhite" :
        $background= gd_filter_adgreen($background);
		return $background;
        break;
		 case  "adblue" :
        $background= gd_filter_adgreen($background);
		return $background;
        break;
	 
 case  "adred" :
        $background= gd_filter_adgreen($background);
		return $background;
        break;

 case  "impact" :
        $background= gd_filter_impact($background);
		return $background;
        break;
 case  "notice" :
        $background= gd_filter_notice($background);
		return $background;
        break;
 case  "exquisite" :
        $background= gd_filter_exquisite($background);
		return $background;
        break;
 case  "classy" :
        $background= gd_filter_classy($background);
		return $background;
        break;


		 case  "adpink" :
        $background= gd_filter_adgreen($background);
		return $background;
        break;
			 case  "adpurple" :
        $background= gd_filter_adgreen($background);
		return $background;
        break;
         case  "fun" :
        $background= gd_filter_fun($background);
		return $background;
        break;
         case  "bold" :
        $background= gd_filter_bold($background);
		return $background;
        break;
         case  "redx" :
        $background= gd_filter_redX($background);
		return $background;
        break;
         case  "sweetbox" :
        $background= gd_filter_sweetbox($background);
		return $background;
        break;
         case  "corporate" :
        $background= gd_filter_corporate($background);
		return $background;
        break;
         case  "corporateblack" :
        $background= gd_filter_corporateblack($background);
		return $background;
        break;
         case  "twisted" :
        $background= gd_filter_twisted($background);
		return $background;
        break;
         case  "whitebrand" :
        $background= gd_filter_whitebrand($background);
		return $background;
        break;
         case  "awesome" :
        $background= gd_filter_awesome($background);
		return $background;
        break; 
		  case  "awesome2" :
        $background= gd_filter_awesome2($background);
		return $background;
        break; 
		  case  "elated" :
        $background= gd_filter_elated($background);
		return $background;
        break; 
		  case  "newsupdate" :
        $background= gd_filter_newsupdate($background);
		return $background;
        break; 
		 case  "professional" :
        $background= gd_filter_professional($background);
		return $background;
        break;	
		
		 case  "clean" :
        $background= gd_filter_clean($background);
		return $background;
        break; 
		 case  "stylish" :
        $background= gd_filter_stylish($background);
		return $background;
        break; 
		case  "tech" :
        $background= gd_filter_tech($background);
		return $background;
        break;
		case  "twitter" :
        $background= gd_filter_twitter($background);
		return $background;
        break;
		case  "awesometweet" :
        $background= gd_filter_awesometweet($background);
		return $background;
        break;
		case  "executive" :
        $background= gd_filter_executive($background);
		return $background;
        break;
		case  "business" :
        $background= gd_filter_business($background);
		return $background;
        break;
		case  "realnews" :
        $background= gd_filter_realnews($background);
		return $background;
        break;
		
		case  "elegant" :
        $background= gd_filter_elegant($background);
		return $background;
        break;
		case  "brownblog" :
        $background= gd_filter_brownblog($background);
		return $background;
        break;
			case  "blogmain" :
        $background= gd_filter_blogmain($background);
		return $background;
        break;
		case  "purpleblog" :
        $background= gd_filter_purpleblog($background);
		return $background;
        break;
		
		case  "redblog" :
        $background= gd_filter_redblog($background);
		return $background;
        break;
		case  "masters" :
        $background= gd_filter_masters($background);
		return $background;
        break;
		case  "blueblog" :
        $background= gd_filter_blueblog($background);
		return $background;
        break;
		case  "greenblog" :
        $background= gd_filter_greenblog($background);
		return $background;
        break;
		
		case  "boldgreen" :
        $background= gd_filter_boldgreen($background);
		return $background;
        break;
		
		case  "boldblue" :
        $background= gd_filter_boldblue($background);
		return $background;
        break;
		case  "boldorange" :
        $background= gd_filter_boldorange($background);
		return $background;
        break;
		case  "boldred" :
        $background= gd_filter_boldred($background);
		return $background;
        break;
	 case  "powerful" :
        $background= gd_filter_powerful($background);
		return $background;
        break;
			 case  "redglory" :
        $background= gd_filter_redglory($background);
		return $background;
        break;
		
		 case  "now" :
        $background= gd_filter_now($background);
		return $background;
        break;
		 case  "rightnow" :
        $background= gd_filter_rightnow($background);
		return $background;
        break;
		 case  "worldnews" :
        $background= gd_filter_worldnews($background);
		return $background;
        break;
		 case  "reporting" :
        $background= gd_filter_reporting($background);
		return $background;
        break;
		 case  "headlines" :
        $background= gd_filter_headlines($background);
		return $background;
        break;
		case  "boldpurple" :
        $background= gd_filter_boldpurple($background);
		return $background;
        break;
		
		case  "boldblack" :
        $background= gd_filter_boldblack($background);
		return $background;
        break;
		 
		
         case  "colored" :
        $background= gd_filter_colored($background);
		return $background;
        break;
         case  "stickynote" :
        $background= gd_filter_stickynote($background);
		return $background;
        break;
         case  "coffee" :
        $background= gd_filter_coffee($background);
		return $background;
        break;
         case  "highlight" :
        $background= gd_filter_highlight($background);
		return $background;
        break;
         case  "funky" :
        $background= gd_filter_funky($background);
		return $background;
        break;
         case  "coolblue" :
        $background= gd_filter_coolblue($background);
		return $background;
        break;
         case  "punch" :
        $background= gd_filter_punch($background);
		return $background;
        break;
			  case  "trends" :
        $background= gd_filter_trends($background);
		return $background;
        break;
		  case  "smart" :
        $background= gd_filter_smart($background);
		return $background;
        break;
         case  "nairobi" :
        $background= gd_filter_nairobi($background);
		return $background;
        break;
         case  "nairobi2" :
        $background= gd_filter_nairobi2($background);
		return $background;
        break;
		
		   case  "news" :
        $background= gd_filter_news($background);
		return $background;
        break;
        
         case  "breaking" :
        $background= gd_filter_breaking($background);
		return $background;
        break;
								   case  "newsy" :
								  $background= gd_filter_newsy($background);
								  return $background;
								  break;
		case  "happening" :
        $background= gd_filter_happening($background);
		return $background;
        break;
		case  "gaa" :
        $background= gd_filter_gaa($background);
		return $background;
        break;
		case  "sevens" :
        $background= gd_filter_sevens($background);
		return $background;
        break;
		case  "live" :
        $background= gd_filter_live($background);
		return $background;
        break;
		case  "exclusive" :
        $background= gd_filter_exclusive($background);
		return $background;
        break;
          case  "newsone" :
        $background= gd_filter_newsone($background);
		return $background;
        break;   
		case  "atnine" :
        $background= gd_filter_atnine($background);
		return $background;
		case  "blank" :
        $background= gd_filter_blank($background);
		return $background;
        break;
        default:
		 
		 
		
           $background= gd_filter_moodswing($background); 
		   
		 
			
			
		   return $background;
	 
    }
	
	
	 
	
	
}

/** Apply 'Contrast' preset */
function gd_filter_contrast($background)
{
	
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 8);
imagefilter($background, IMG_FILTER_CONTRAST, -8);

 


	return $background;
	
}	 
 //posted
function gd_filter_bold($background)
{ 
imagefilter($background, IMG_FILTER_BRIGHTNESS, -50);
$background = gd_apply_overlay($background, 'brushmesh', 100);
/*$background = gd_apply_overlay($background, 'glitter', 100);*/
$background = gd_apply_overlay($background, 'shadow', 100);
$background = gd_apply_overlay($background, 'logoStartag', 100);
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-HvEx.otf'; //font used
$font_color = imagecolorallocate($background,  255, 255, 255); // Create blue color 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  }
 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");

$text = strtoupper($text);
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <= 13)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text);
imagettftext($background,$font_size, 0, $x, $y, $font_color, $fontX, $text); //Write 


$user2      = strtoupper(user()); 
imagettftext($background,16, 0, 20, 40, $font_color, $fontX, $user2); 

$user3      = "*".strtoupper(username()); 
imagettftext($background,16, 0, 20, 60, $font_color, $fontZ, $user3); 

return $background; 
	
	
}


function gd_filter_redX($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  }

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 
if (empty($moodswing2))
{
$background = gd_apply_overlay($background, 'redX', 100);
  
}
else
{
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -60);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
 
	 
	
} 



$background = gd_apply_overlay($background, 'logoStartag', 100);
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-HvEx.otf'; //font used
$font_color = imagecolorallocate($background,  255, 255, 255); // Create blue color 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  }
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");

$text = strtoupper($text);
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <= 15)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text);
imagettftext($background,$font_size, 0, $x, $y, $font_color, $fontX, $text); //Write 



$user2      = strtoupper(user()); 
imagettftext($background,16, 0, 20, 40, $font_color, $fontX, $user2); 

$user3      = "*".strtoupper(username()); 
imagettftext($background,16, 0, 20, 60, $font_color, $fontZ, $user3); 

return $background; 
	
	
}



function gd_filter_sweetbox($background)
{ 
 
$background = gd_apply_overlay($background, 'sweetbox', 100);
$background = gd_apply_overlay($background, 'brushmesh', 100);
$background = gd_apply_overlay($background, 'logoeziki', 100);
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-HvEx.otf'; //font used
$font_color = imagecolorallocate($background,  255, 255, 255);  
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  }
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");
$text = strtoupper($text);
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <= 12)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text);
imagettftext($background,$font_size, 0, $x, $y, $font_color, $fontX, $text); //Write 



$user2      = strtoupper(user()); 
imagettftext($background,16, 0, 20, 40, $font_color, $fontX, $user2); 

$user3      = "*".strtoupper(username()); 
imagettftext($background,16, 0, 20, 60, $font_color, $fontZ, $user3); 

return $background; 
	
	
}
function gd_filter_corporate($background)
{ 
 
$background = gd_apply_overlay($background, 'corporate', 100);

 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$font_color = imagecolorallocate($background,  89, 89, 89); // Create blue color 
$font_color2 = imagecolorallocate($background,  208, 208, 208); // Create blue color
$font_color3 = imagecolorallocate($background,  0, 0, 0); // Create blue colo  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  }; 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=26)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text);
imagettftext($background,$font_size, 0, $x, $y, $font_color3, $fontZ, $text); //Write 



$user2      = "*".username(); 
imagettftext($background,30, 0, 20, 40, $font_color, $fontY, $user2); 

$user3      = strtolower(user()); 
imagettftext($background,20, 0, 20, 60, $font_color, $fontZ, $user3); 


$slug      = "startag.co/".slug();
imagettftext($background,35, 0, 20, 570, $font_color2, $fontZ, $slug); 
return $background; 
	
	
}


function gd_filter_corporateblack($background)
{ 
 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 
if (empty($moodswing2))
{
$hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'corporateblack', 100);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'corporateblack', 70);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'corporateblack', 70);} 
  



}

 
 
 
 
 


 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$font_color = imagecolorallocate($background,  255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,  208, 208, 208); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=40)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text);
imagettftext($background,$font_size, 0, $x, $y, $font_color, $fontZ, $text); //Write 


$user2      = "*".username(); 
imagettftext($background,30, 0, 20, 40, $font_color, $fontY, $user2); 

$user3      = strtolower(user()); 
imagettftext($background,20, 0, 20, 60, $font_color, $fontZ, $user3); 


$slug      = "startag.co/".slug();
imagettftext($background,20, 0, 20, 570, $font_color2, $fontZ, $slug); 
   










 
return $background; 
	
	
}


function gd_filter_twisted($background)
{ 
 
$background = gd_apply_overlay($background, 'twisted', 100);

 
$fontY = 'assets/fonts/Harabara.ttf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-LtCnO.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$font_color = imagecolorallocate($background,   89,89,89); // Create blue color 
$font_color2 = imagecolorallocate($background,  204, 0, 1); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255, 255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,20,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=20)) ;
$y = (600 - $txt_height) / 2;
$x = 335;
$text = removeslashes($text);
imagettftext($background,$font_size, 0, $x, $y, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.8*250);
$user2      = "*".username(); 
$user3      = strtolower(user()); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=30)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;



$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox($font_size-5, 0, $fontZ, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,$font_size, 0, $x1, 40, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size-5, 0, $x2, 70, $font_color3, $fontZ,$user3 ); //Write 


 
imagettftext($background,20, 0, 20, 580, $font_color3, $fontZ, $slug);

 
$background = gd_apply_overlay($background, 'glitter', 50);
	


 
return $background; 
	
	
}



function gd_filter_whitebrand($background)
{ 
 
$background = gd_apply_overlay($background, 'whitebrand', 100);
 
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
$font_color = imagecolorallocate($background,   89,89,89); // Create blue color 
$font_color2 = imagecolorallocate($background,  204, 0, 1); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0, 0); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,18,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*220);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 350, $y, $font_color3, $fontW, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtolower("*".username()); 
$user3      = strtolower(user()); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=30)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

$dimensions = imagettfbbox(30, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox($font_size-5, 0, $fontZ, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,30, 0, $x1, 42, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size-5, 0, $x2, 65, $font_color4, $fontZ, $user3); //Write 

 
 

 
return $background; 
	
	
}
function imagettfstroketext(&$image, $size, $angle, $x, $y, &$textcolor, &$strokecolor, $fontfile, $text, $px) {
 
    for($c1 = ($x-abs($px)); $c1 <= ($x+abs($px)); $c1++)
        for($c2 = ($y-abs($px)); $c2 <= ($y+abs($px)); $c2++)
            $bg = imagettftext($image, $size, $angle, $c1, $c2, $strokecolor, $fontfile, $text);
 
   return imagettftext($image, $size, $angle, $x, $y, $textcolor, $fontfile, $text);
}
function gd_filter_awesome($background)
{ 
 
$background = gd_apply_overlay($background, 'awesome', 100);
 
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$font_color = imagecolorallocate($background,   89,89,89); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,38,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=18)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,$font_size, 0, $x, $y, $font_color3, $fontW, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtolower("*".username()); 
$user3      = strtolower(user()); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,$font_size, 0, 325, 30, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 320, 70, $font_color2, $fontZ, $user3); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
 
imagettftext($background,35, 0, 20, 570, $font_color2, $fontZ, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_awesome2($background)
{ 
 
$background = gd_apply_overlay($background, 'awesome2', 100);
 
 
$fontY = 'assets/fonts/nulshockbd.ttf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/OpenSans-Semibold.ttf'; //font used
$font_color = imagecolorallocate($background,   89,89,89); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,44,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=14)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 40, 420, $font_color3, $fontW, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtolower("*".username()); 
$user3      = strtolower(user()); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=15)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,$font_size, 0, 30, 25, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 25, 55, $font_color2, $fontY, $user3); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
 
imagettftext($background,12, 0, 25, 570, $font_color2, $fontY, $slug); 
   

 
return $background; 
	
	
}



function gd_filter_elated($background)
{ 
 
$background = gd_apply_overlay($background, 'elated', 100);

$fontY = 'assets/fonts/HelveticaNeueLTStd-BlkCn.otf'; //font used
$fontX = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$font_color = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 223,67); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,40,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*400);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=14)) ;
$y = (400 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 200, 435, $font_color3, $fontW, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtolower("*".username()); 
$user3      = strtolower(user()); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=15)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;



$user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$secondname =$myArray[1];




imagettftext($background,35 , 0, 40, 460, $font_color4, $fontX, ucwords($firstname)); //Write  

imagettftext($background,20, 0, 200,410, $font_color4, $fontY, $user3); //Write 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
imagettftext($background,$font_size, 0, 28, 585, $font_color, $fontY, $user2); //Write 


 $dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-30;  
imagettftext($background,20, 0, $x1, 580, $font_color2, $fontY, $slug); 
 
return $background; 
	
	
}










function gd_filter_twitter($background)
{ 
 

  if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
$moodswing2 =strtolower($moodswing2);

$hasPicture = verifyStartag();

if (empty($moodswing2))
{
	
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'twitter', 90);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'twitter2', 100);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'twitter2', 100);}
}
else
{
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -50);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'twitter', 60);
	$background = gd_apply_overlay($background, 'shadow', 100);
}
 
$fontY = 'assets/fonts/TitilliumWeb-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/OpenSans-CondBold_0.ttf'; //font used
$fontZ = 'assets/fonts/TitilliumWeb-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=22)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;

$text = removeslashes($text); 
imagettftext($background,$font_size, 0, $x, $y, $font_color3, $fontX, $text); //Write 



$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,$font_size, 0, 35, 60, $font_color2, $fontY, $user3); //Write 
imagettftext($background,$font_size-2, 0, 30, 90, $font_color2, $fontZ, $user2); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-50; 
imagettftext($background,20, 0, $x2, 570, $font_color2, $fontY, $slug); 
   

 
return $background; 
	
	
}

function gd_filter_default($background)
{ 
 
 
 
 $background = gd_apply_effect($background, 'shadow', 100);
$fontY = 'assets/fonts/TitilliumWeb-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/OpenSans-CondBold_0.ttf'; //font used
$fontZ = 'assets/fonts/TitilliumWeb-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=22)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, $x, $y, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,$font_size, 0, 35, 60, $font_color2, $fontY, $user3); //Write 
imagettftext($background,$font_size-2, 0, 30, 90, $font_color2, $fontZ, $user2); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-50; 
imagettftext($background,20, 0, $x2, 570, $font_color2, $fontY, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_awesometweet($background)
{ 
 $hasPicture = verifyStartag(); 

if (!empty($hasPicture)) { 				   
imagefilter($background, IMG_FILTER_GRAYSCALE);
imagefilter($background, IMG_FILTER_BRIGHTNESS, 5);
imagefilter($background, IMG_FILTER_CONTRAST, -15);
 
}
if (!empty($_GET['cl'])) { 
imagefilter($background, IMG_FILTER_GRAYSCALE);
imagefilter($background, IMG_FILTER_BRIGHTNESS, 5);
imagefilter($background, IMG_FILTER_CONTRAST, -15);
 
} 
  
$background = gd_apply_overlay($background, 'awesometweet', 100);
 
$fontA = 'assets/fonts/comesinhandy_1.ttf'; //font used 
$fontY = 'assets/fonts/TitilliumWeb-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-LtCnO.otf'; //font used
$fontZ = 'assets/fonts/TitilliumWeb-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,35,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=22)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text); 
imagettftext($background,$font_size, 0, 20, 300, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,45, 0, 25, 540, $font_color2, $fontA, $user3); //Write 
imagettftext($background,$font_size-2, 0, 20, 570, $font_color2, $fontZ, $user2); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-10; 
imagettftext($background,20, 0, $x2, 30, $font_color2, $fontY, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_executive($background)
{ 
 
$background = gd_apply_overlay($background, 'executive', 100);
 
$fontA = 'assets/fonts/comesinhandy_1.ttf'; //font used 
$fontY = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontZ = 'assets/fonts/TitilliumWeb-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   218,122, 32); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
$font_color4 = imagecolorallocate($background,  249, 213,175); // Create blue color 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,23,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=16)) ;
$y = (340 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text); 
imagettftext($background,$font_size, 0, 305, $y, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;


/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(15, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-50; 
imagettftext($background,15, 0, $x2, 280, $font_color4, $fontY, $slug); 
   
$user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$secondname =$myArray[1];
 
 
 
 
 $dimensions = imagettfbbox(20, 0, $fontY, $firstname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,20, 0, $x2, 490, $font_color2, $fontY, $firstname); 


$dimensionsx = imagettfbbox(20, 0, $fontX, $secondname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 - $textWidthx-5; 
imagettftext($background,20, 0, $xx, 490, $font_color2, $fontX, $secondname); 



 $dimensions = imagettfbbox(20, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,20, 0, $x2, 570, $font_color, $fontY, $user2); 





return $background; 
	
	
}
function gd_filter_business($background)
{ 
 
$background = gd_apply_overlay($background, 'business', 100);
 
$fontA = 'assets/fonts/comesinhandy_1.ttf'; //font used 
$fontY = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontZ = 'assets/fonts/TitilliumWeb-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,50,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=16)) ;
$y = (340 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text); 
imagettftext($background,$font_size, 0, 30, 410, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;


/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(14, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,14, 0, $x2, 40, $font_color2, $fontY, $slug); 
   



$dimensions = imagettfbbox(40, 0, $fontA, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,40, 0, 10, 570, $font_color2, $fontA, $user2); 


 $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =$myArray[0];
 
 
 
 
 $dimensions = imagettfbbox(20, 0, $fontY, $firstname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,20, 0, $x2, 570, $font_color2, $fontY, $firstname); 


$dimensionsx = imagettfbbox(20, 0, $fontX, $secondname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 - $textWidthx-5; 
imagettftext($background,20, 0, $xx, 570, $font_color2, $fontX, $secondname); 



return $background; 
	
	
}
function gd_filter_realnews($background)
{ 
 $background = gd_apply_overlay($background, 'realnews', 100); 

 
$fontA = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used 
$fontY = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/OpenSans-Regular.ttf'; //font used
$fontZ = 'assets/fonts/TitilliumWeb-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color
$font_color4 = imagecolorallocate($background,  197, 10,0); // Create blue color   
$font_color5 = imagecolorallocate($background,  0, 0,0); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,23,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=12)) ;
$y = (370 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text); 
imagettftext($background,$font_size, 0, 385, $y, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = strtoupper(user());  
$slug      = strtoupper("startag.co/".slug()); 
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,16, 0, 385, 50, $font_color2, $fontY, $user2);

 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/

imagettftext($background,8, 0, 25, 585, $font_color2, $fontY, $slug); 
   
$dimensions = imagettfbbox(12, 0, $fontA, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-5; 
imagettftext($background,12, 0, $x2, 348, $font_color4, $fontA, $user3);
 $date =date('d.m.y ');
imagettftext($background,12, 0, 370, 348, $font_color5, $fontA, $date);








return $background; 
	
	
}function gd_filter_elegant($background)
{ 
 

$background = gd_apply_overlay($background, 'elegant', 100);
$fontA = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used 
$fontY = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-LtCn.otf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/OpenSans-Regular.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color
$font_color4 = imagecolorallocate($background,  197, 10,0); // Create blue color   
$font_color5 = imagecolorallocate($background,  203, 50,93); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,35,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=18)) ;
$y = (370 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $text = removeslashes($text);
imagettftext($background,$font_size, 0, 265, 285, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = strtoupper(user());  
$slug      = strtoupper("startag.co/".slug()); 
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;



 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(8, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,8, 0, $x2, 475, $font_color3, $fontY, $slug);

$dimensions = imagettfbbox(8, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;  
imagettftext($background,8, 0, $x2,462, $font_color3, $fontY, $user2);


   
$dimensions = imagettfbbox(12, 0, $fontA, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-5; 



$user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$secondname =$myArray[1];
 
 
 
 
 $dimensions = imagettfbbox(20, 0, $fontY, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-360; 
imagettftext($background,20, 0, $x2, 470, $font_color2, $fontY, $secondname); 


$dimensionsx = imagettfbbox(20, 0, $fontZ, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 - $textWidthx-6; 
imagettftext($background,20, 0, $xx, 470, $font_color2, $fontZ, $firstname); 





 






return $background; 
	
	
}
function gd_filter_tech($background)
{ 
 

 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 

$hasPicture = verifyStartag();




if (empty($moodswing2))
{

if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'tech', 100);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'tech2', 100);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'tech2', 100);}




}
else
{
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -50);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'shadow', 100);
	$background = gd_apply_overlay($background, 'tech2', 100);
	
}
 
$fontY = 'assets/fonts/TitilliumWeb-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/TitilliumWeb-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=15)) ;
$y = (400 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 $text = removeslashes($text);
imagettftext($background,$font_size, 0, 205, 430, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

$text = removeslashes($text);
imagettftext($background,$font_size, 0, 35, 60, $font_color2, $fontY, $user3); //Write 
imagettftext($background,$font_size-2, 0, 30, 90, $font_color2, $fontZ, $user2); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-50; 
imagettftext($background,20, 0, $x2, 570, $font_color2, $fontY, $slug); 
   

 
return $background; 
	
	
}


function gd_filter_brownblog($background)
{ 
 
$hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'brownblog', 90);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'brownblog', 90);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'brownblog', 90);}
 

 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   202, 117, 26); // Create blue color  
$font_color3 = imagecolorallocate($background,  131, 141,145); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=16)) ;
$y = (400 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 20, 410, $font_color3, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;


imagettftext($background,16, 0, 30, 52, $font_color, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 20, 380, $font_color2, $fontY, $user3); //Write 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(15, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,15, 0, $x2, 52, $font_color4, $fontY, $slug); 
   

 
return $background; 
	
	
}

function gd_filter_blogmain($background)
{ 
 
$background = gd_apply_overlay($background, 'blogmain', 95);
 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   0, 0, 0); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color  
$font_color4 = imagecolorallocate($background,  131, 141,145); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
$user2      = "*".username(); 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", "$user2:".$text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=14)) ;
$y = (400 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 20, 390, $font_color4, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;


/*imagettftext($background,16, 0, 15, 30, $font_color4, $fontY, $user2);*/ //Write 
imagettftext($background,$font_size, 0, 20, 355, $font_color2, $fontY, $user3); //Write 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(15, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-25; 
imagettftext($background,15, 0, $x2, 530, $font_color4, $fontY, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_redblog($background)
{ 
 
 
$hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'redblog', 90);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'redblog', 90);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'redblog', 90);}
  
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   220, 0, 48); // Create blue color  
$font_color3 = imagecolorallocate($background,  131, 141,145); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=16)) ;
$y = (400 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 20, 410, $font_color3, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;


imagettftext($background,16, 0, 30, 52, $font_color, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 20, 380, $font_color2, $fontY, $user3); //Write 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(15, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,15, 0, $x2, 52, $font_color4, $fontY, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_masters($background)
{ 
 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 
if (empty($moodswing2))
{
$background = gd_apply_overlay($background, 'masters', 100);
}
else
{imagefilter($background, IMG_FILTER_BRIGHTNESS, -15);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'shadow', 100);
	}

 
 
$fontY = 'assets/fonts/MyriadPro-Bold.otf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeue LT 35 Thin.ttf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   220, 0, 48); // Create blue color  
$font_color3 = imagecolorallocate($background,  131, 141,145); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=35)) ;
$y = (600 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 
imagettftext($background,25, 0, 40, $y, $font_color, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=30)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;
 
imagettftext($background,$font_size, 0, 40, 100, $font_color, $fontY, $user3); //Write 

imagettftext($background,15, 0, 40, 570, $font_color4, $fontW, $user2); 
  $bio      =  bio() ;
 
imagettftext($background,14, 0,40, 550, $font_color, $fontZ, $bio);    

 
return $background; 
	
	
}
function gd_filter_blueblog($background)
{ 
 
 
 
 
$hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'blueblog', 90);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'blueblog', 90);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'blueblog', 90);} 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   52, 101, 170); // Create blue color  
$font_color3 = imagecolorallocate($background,  131, 141,145); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=16)) ;
$y = (400 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 20, 410, $font_color3, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;


imagettftext($background,16, 0, 30, 52, $font_color, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 20, 380, $font_color2, $fontY, $user3); //Write 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(15, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,15, 0, $x2, 52, $font_color4, $fontY, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_greenblog($background)
{ 
 
 
$hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'greenblog', 90);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'greenblog', 90);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'greenblog', 90);} 
  
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   9, 162, 117); // Create blue color  
$font_color3 = imagecolorallocate($background,  131, 141,145); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=16)) ;
$y = (400 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 20, 410, $font_color3, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;


imagettftext($background,16, 0, 30, 52, $font_color, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 20, 380, $font_color2, $fontY, $user3); //Write 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(15, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,15, 0, $x2, 52, $font_color4, $fontY, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_boldgreen($background)
{ 
 
$background = gd_apply_overlay($background, 'boldgreen', 100);
 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,22,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 25, $y, $font_color3, $fontY, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;


imagettftext($background,18, 0, $x, 52, $font_color, $fontY, $user2); //Write 


do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontZ,$slug);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,18, 0, $x, 490, $font_color4, $fontZ, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_boldpurple($background)
{ 
 
$background = gd_apply_overlay($background, 'boldpurple', 100);
 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,22,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 25, $y, $font_color3, $fontY, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;


imagettftext($background,18, 0, $x, 52, $font_color, $fontY, $user2); //Write 


do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontZ,$slug);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,18, 0, $x, 490, $font_color4, $fontZ, $slug); 
   

 
return $background; 
	
	
}


 

function gd_filter_boldblack($background)
{ 
 
$background = gd_apply_overlay($background, 'boldblack', 100);
 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,22,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 25, $y, $font_color3, $fontY, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;


imagettftext($background,18, 0, $x, 52, $font_color, $fontY, $user2); //Write 


do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontZ,$slug);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,18, 0, $x, 490, $font_color4, $fontZ, $slug); 
   

 
return $background; 
	
	
}

function gd_filter_boldred($background)
{ 
 
$background = gd_apply_overlay($background, 'boldred', 100);
 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,22,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 25, $y, $font_color3, $fontY, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;


imagettftext($background,18, 0, $x, 52, $font_color, $fontY, $user2); //Write 


do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontZ,$slug);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,18, 0, $x, 490, $font_color4, $fontZ, $slug); 
   

 
return $background; 
	
	
}

function gd_filter_powerful($background)
{ 
 

if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 
if (empty($moodswing2))
{
	
	
$hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'powerful', 100);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'powerful', 80);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'powerful', 80);} 
 }
 if (!empty($moodswing2))
{
$background = gd_apply_overlay($background, 'powerful', 80); 
}
 
 
 
 
 
 
 
 
$fontY = 'assets/fonts/Exo2.0-ExtraBold_0.otf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color4 = imagecolorallocate($background,  0, 0,0); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,23,"\n");
 
 
$text     = strtoupper($text) ;
imagettftext($background,30, 0, 32,70, $font_color3, $fontY, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = strtoupper(user()) ;
$slug      = "startag.co/".slug();
 
imagettftext($background,32, 0, 32,470, $font_color4, $fontY, $user3); //Write 
imagettftext($background,32, 0, 32, 560, $font_color, $fontY, $user2); //Write 
imagettftext($background,18, 0, 32, 430, $font_color4, $fontZ, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_redglory($background)
{ 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 
if (empty($moodswing2))
{
imagefilter($background, IMG_FILTER_COLORIZE ,126, 23, 27); 
$background = gd_apply_overlay($background, 'redglory', 100);
}
else
{
	
imagefilter($background, IMG_FILTER_COLORIZE ,126, 23, 27); 
$background = gd_apply_overlay($background, 'redglory', 100);
}


 
 

 	imagefilter($background, IMG_FILTER_BRIGHTNESS, -70);
imagefilter($background, IMG_FILTER_CONTRAST, -20);
$fontY = 'assets/fonts/HelveticaNeueLTStd-Hv.otf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color4 = imagecolorallocate($background,  0, 0,0); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,16,"\n");
 
 
$text     = strtoupper($text) ;
imagettftext($background,25, 0, 40,200, $font_color3, $fontY, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = ucwords(user()) ;
$slug      = "startag.co/".slug();
 
/*imagettftext($background,32, 0, 32,470, $font_color4, $fontY, $user3); //Write 


imagettftext($background,32, 0, 32, 560, $font_color, $fontY, $user2); //Write */






  $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

  






imagettftext($background,20, 0, 40,570, $font_color, $fontW, $secondname); //Write  

imagettftext($background,14, 0, 40, 548, $font_color, $fontZ, $slug); 

   
$background = gd_apply_effect($background, 'glitter', 100);
 
return $background; 
	
	
}
function gd_filter_now($background)
{ 
 
$background = gd_apply_overlay($background, 'now', 100);
 
 
$fontY = 'assets/fonts/Exo2.0-ExtraBold_0.otf'; //font used
$fontX = 'assets/fonts/OpenSans-CondBold_0.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-BdEx.otf'; //font used
$fontW = 'assets/fonts/MyriadPro-Bold.otf'; //font used
$font_color = imagecolorallocate($background,   230,180, 58); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   170, 0, 13); // Create blue color  
$font_color4 = imagecolorallocate($background,  70, 70,70); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 


 $text = wordwrap($text,43,"\n");
 $text=strtoupper($text);
imagettftext($background,16, 0, 165, 525, $font_color4, $fontX,$text);



$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = strtoupper(user()) ;
$slug      = "startag.co/".slug();
  $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$user2 = strtoupper($user2) ;

 imagettftext($background,10, 0, 10, 530, $font_color3, $fontZ, $user2); 
imagettftext($background,20, 0, 10,558, $font_color2, $fontZ, $firstname); //Write  
 
  $date =date('H:i');
 $date2 =date('d/m/Y ');
 
 
imagettftext($background,18, 0, 10, 587, $font_color, $fontW, $date); 




 $slug = strtoupper($slug);  
$dimensions = imagettfbbox(12, 0, $fontX, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-10; 
imagettftext($background,12, 0, $x2, 490, $font_color, $fontX, $slug);  
return $background; 
	
	
}

function gd_filter_rightnow($background)
{ 
  $background = gd_apply_effect($background, 'blueflare', 100);
$background = gd_apply_overlay($background, 'rightnow', 100);
 
 
$fontY = 'assets/fonts/HelveticaNeueLTStd-BdExO.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-BdEx.otf'; //font used
$fontW = 'assets/fonts/MyriadPro-Bold.otf'; //font used
$font_color = imagecolorallocate($background,   230,180, 58); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   170, 0, 13); // Create blue color  
$font_color4 = imagecolorallocate($background,  0, 0,0); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 


 $text = wordwrap($text,40,"\n");
/* $text=strtoupper($text);*/
imagettftext($background,14, 0, 211, 500, $font_color2, $fontX,$text);



$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = strtoupper(user()) ;
$slug      = "startag.co/".slug();
  $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$user2 = strtoupper($user2) ;

 
 
 $dimensions = imagettfbbox(15, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-52; 
imagettftext($background,15, 0, $x2, 52, $font_color2, $fontY, $user2); 

 $bio      =  strtoupper(bio()) ;
 
 
imagettftext($background,7, 0,211, 580, $font_color2, $fontZ, $bio);  
 
 
 
 
 
 
  
 
  $date =date('H:i');
 $date2 =date('d/m/Y ');
 
 
imagettftext($background,18, 0, 110, 465, $font_color4, $fontW, $date); 




 $slug = strtoupper($slug);  
$dimensions = imagettfbbox(12, 0, $fontX, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-10; 
imagettftext($background,7, 0, 13, 580, $font_color, $fontZ, $slug); 
return $background; 
	
	
}



function gd_filter_headlines($background)
{ 
  $background = gd_apply_effect($background, 'blueflare', 100);
$background = gd_apply_overlay($background, 'headlines', 100);
 
$fontA = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used 
$fontY = 'assets/fonts/HelveticaNeueLTStd-BdExO.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-BdEx.otf'; //font used
$fontW = 'assets/fonts/MyriadPro-Bold.otf'; //font used
$font_color = imagecolorallocate($background,   139,139, 139); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   170, 0, 13); // Create blue color  
$font_color4 = imagecolorallocate($background,  0, 0,0); // Create blue color  
$font_color5 = imagecolorallocate($background,  247, 148,29); // Create blue color 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 


 $text = wordwrap($text,42,"\n");
 $text=strtoupper($text);
 
 
 $limit=11;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}
$text2 = removeslashes($text2); 
imagettftext($background,14, 0, 30, 510, $font_color4, $fontX,$text2);



$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = username();
$country      = strtoupper(country());  
$user3      = strtoupper(user()) ;
$slug      = "startag.co/".slug();
  $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$user2 = strtoupper($user2) ;

 
 
 
imagettftext($background,18, 0, 152, 478, $font_color4, $fontA, $user2); 

 $bio      =  strtoupper(bio()) ;
 
 
imagettftext($background,7, 0,100, 566, $font_color2, $fontZ, $bio);  
 
 
 
 
 
 
  
 
  $date =date('H:i');
 $date2 =date('d/m/Y ');
 
 
imagettftext($background,9, 0, 23, 51, $font_color2, $fontW, $date); 
imagettftext($background,10, 0, 23, 31, $font_color4, $fontW, $country); 



 $slug = strtoupper($slug);  
$dimensions = imagettfbbox(12, 0, $fontX, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-10; 
imagettftext($background,7, 0, 470, 566, $font_color, $fontZ, $slug); 
return $background; 
	
	
}

function gd_filter_worldnews($background)
{ 
 
$background = gd_apply_overlay($background, 'worldnews', 100);
 
$fontA = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used 
$fontY = 'assets/fonts/HelveticaNeueLTStd-BdExO.otf'; //font used
$fontX = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-BdEx.otf'; //font used
$fontW = 'assets/fonts/MyriadPro-Bold.otf'; //font used
$font_color = imagecolorallocate($background,   139,139, 139); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   170, 0, 13); // Create blue color  
$font_color4 = imagecolorallocate($background,  0, 0,0); // Create blue color  
$font_color5 = imagecolorallocate($background,  247, 148,29); // Create blue color 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 


 $text = wordwrap($text,47,"\n");
 $text=strtoupper($text);
 
 
 $limit=16;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}
$text2 = removeslashes($text2); 
imagettftext($background,10, 0, 10, 520, $font_color2, $fontX,$text2);



$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = username();
$country      = strtoupper(country());  
$user3      = strtoupper(user()) ;
$slug      = "startag.co/".slug();
$slug      = strtoupper($slug) ;
  $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$user2 = strtoupper($user2) ;

 
 
 
imagettftext($background,18, 0, 100, 42, $font_color2, $fontA, $user2); 

 
 
imagettftext($background,7, 0, 10, 590, $font_color, $fontZ, $slug); 
return $background; 
	
	
}

function gd_filter_reporting($background)
{ 
 
$background = gd_apply_overlay($background, 'reporting', 100);
 
$fontA = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used 
$fontY = 'assets/fonts/nulshockbd.ttf'; //font used
$fontX = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-BdEx.otf'; //font used
$fontW = 'assets/fonts/MyriadPro-Bold.otf'; //font used
$font_color = imagecolorallocate($background,   139,139, 139); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   170, 0, 13); // Create blue color  
$font_color4 = imagecolorallocate($background,  41, 41,41); // Create blue color  
$font_color5 = imagecolorallocate($background,  247, 148,29); // Create blue color 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 


 $text = wordwrap($text,47,"\n");
 $text=strtoupper($text);
 
 
 $limit=16;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}
$text2 = removeslashes($text2); 
imagettftext($background,10, 0, 10, 520, $font_color2, $fontX,$text2);



$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = username();
$country      = strtoupper(country());  
$user3      = strtoupper(user()) ;
$slug      = "startag.co/".slug();
$slug      = strtoupper($slug) ;
  $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$user2 = strtoupper($user2) ;

 
 
imagettftext($background,25, 0, 380, 540, $font_color4, $fontW, $firstname);
 
 
imagettftext($background,7, 0, 10, 591, $font_color2, $fontZ, $slug); 
return $background; 
	
	
}

function gd_filter_boldorange($background)
{ 
 
$background = gd_apply_overlay($background, 'boldorange', 100);
 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,22,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 25, $y, $font_color3, $fontY, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;


imagettftext($background,18, 0, $x, 52, $font_color, $fontY, $user2); //Write 


do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontZ,$slug);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,18, 0, $x, 490, $font_color4, $fontZ, $slug); 
   

 
return $background; 
	
	
}

function gd_filter_boldblue($background)
{ 
 
$background = gd_apply_overlay($background, 'boldblue', 100);
 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,22,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 25, $y, $font_color3, $fontY, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;


imagettftext($background,18, 0, $x, 52, $font_color, $fontY, $user2); //Write 


do{
	$font_size++;
	$p = imagettfbbox(18,0,$fontZ,$slug);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,18, 0, $x, 490, $font_color4, $fontZ, $slug); 
   

 
return $background; 
	
	
}


function gd_filter_purpleblog($background)
{ 
 
$background = gd_apply_overlay($background, 'purpleblog', 90);
 
 
$fontY = 'assets/fonts/Montserrat-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontW = 'assets/fonts/TitilliumWeb-ExtraLight_0.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   233, 143, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  131, 141,145); // Create blue color  
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=16)) ;
$y = (400 - $txt_height) / 2;
$x = (400 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 20, 410, $font_color3, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;


imagettftext($background,16, 0, 30, 52, $font_color, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 20, 380, $font_color2, $fontY, $user3); //Write 
/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(15, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,15, 0, $x2, 52, $font_color4, $fontY, $slug); 
   

 
return $background; 
	
	
}
function gd_filter_fun($background)
{ 
 
 
 
 
 $hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'fun', 100);
$font_color3 = imagecolorallocate($background,  0, 0,0);}
if (!empty($hasPicture)) {$font_color3 = imagecolorallocate($background,  255, 255,255); 
$background = gd_apply_overlay($background, 'black', 50);}
if (!empty($_GET['cl'])) { $font_color3 = imagecolorallocate($background,  255, 255,255);
$background = gd_apply_overlay($background, 'black', 50); }
 
 
 

 
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/comesinhandy_1.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/hand-of-sean_0.ttf'; //font used
$font_color = imagecolorallocate($background,   242, 101,34); // Create blue color 
$font_color2 = imagecolorallocate($background,   0, 174, 239); // Create blue color  

$font_color4 = imagecolorallocate($background,  89, 89,89); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,32,"\n");
 if (!empty($hasPicture)) {$text = wordwrap($text,40,"\n"); }
if (!empty($_GET['cl'])) { $text = wordwrap($text,40,"\n"); }
$font_size = 1;


$txt_max_width = intval(0.7*600);
$fonta = 14;
$space = 150;
if (!empty($hasPicture)) {$fonta = 22;$space = 80; }
if (!empty($_GET['cl'])) {$fonta = 22; $space = 80;}



do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}


while (($txt_width <= $txt_max_width)  &&   ($font_size   <= $fonta)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0,$space, 240, $font_color3, $fontW, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = strtolower(user()); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=35)) ;
$y = (250 - $txt_height) / 2;
$x = (200 - $txt_width) / 2;



$dimensions = imagettfbbox(30, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox(25, 0, $fontZ, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,30, 0, $x1, 40, $font_color2, $fontY, $user2); //Write 
imagettftext($background,25, 0, $x2, 70, $font_color4, $fontZ,$user3 ); //Write 



 
imagettftext($background,40, 0, 20, 570, $font_color, $fontX, $slug); 
   

 
return $background; 
	
	
}




function gd_filter_colored($background)
{ 
 

  if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
$moodswing2 =strtolower($moodswing2);

$hasPicture = verifyStartag();

if (empty($moodswing2))
{
	
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'colored', 90);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'colored2', 100);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'colored2', 100);}
}
else
{
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -50);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'colored2', 100);
	$background = gd_apply_overlay($background, 'shadow', 100);
}
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/hand-of-sean_0.ttf'; //font used
$font_color = imagecolorallocate($background,   242, 101,34); // Create blue color 
$font_color2 = imagecolorallocate($background,   0, 174, 239); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color 
$font_color4 = imagecolorallocate($background,  89, 89,89); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,35,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=18)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 35, 200, $font_color3, $fontW, $text); //Write 




$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox($font_size, 0, $fontZ, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,$font_size, 0, $x1, 50, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, $x2, 85, $font_color4, $fontZ,$slug ); //Write 


 
imagettftext($background,20, 0, 20, 550, $font_color, $fontW, $slug); 
   

 
return $background; 
	

	
}


function gd_filter_stickynote($background)
{ 
 


  if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 
if (empty($moodswing2))
{
$background = gd_apply_overlay($background, 'stickynote', 100);
$font_color = imagecolorallocate($background,   0, 0, 0); // Create blue color 
$font_color2 = imagecolorallocate($background,   0, 0, 0); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color 
$font_color4 = imagecolorallocate($background,  89, 89,89); // Create blue color  
}
else
{
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -60);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255, 255); // Create blue color 
$font_color4 = imagecolorallocate($background, 255, 255, 255); // Create blue color  
$background = gd_apply_overlay($background, 'shadow', 100);
	 
	
}  
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/mathilde.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

            

if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) ) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,50, 0, 40, $y, $font_color3, $fontX, $text); //Write 
 
 
 
$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox($font_size, 0, $fontZ, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,$font_size, 0, $x1, 50, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, $x2, 85, $font_color4, $fontZ,$slug ); //Write 

 
 
   
$dimensions = imagettfbbox(20, 0, $fontW, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;
imagettftext($background,20, 0, $x2, 560, $font_color, $fontW, $user3); 


return $background; 
	
	
}


 function gd_filter_coffee($background)
{ 
 
$background = gd_apply_overlay($background, 'coffee', 100);
 
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/Parisienne-Regular.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/OlympicBranding.ttf'; //font used
$font_color = imagecolorallocate($background,   0, 0, 0); // Create blue color 
$font_color2 = imagecolorallocate($background,   0, 0, 0); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color 
$font_color4 = imagecolorallocate($background,  89, 89,89); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,32,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) ) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,30, 0, 50, $y, $font_color3, $fontX, $text); //Write 
 
 
$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox($font_size, 0, $fontZ, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,$font_size, 0, $x1, 40, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, $x2, 70, $font_color4, $fontZ,$slug ); //Write 
 
 
   
$dimensions = imagettfbbox(70, 0, $fontW, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;
imagettftext($background,35, 0, 20, 550, $font_color, $fontW, $user3); 


return $background; 
	
	
}



 function gd_filter_highlight($background)
{ 
 
$background = gd_apply_overlay($background, 'highlight', 100);
 
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/Yellowtail-Regular.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background, 255, 255, 255); // Create blue color 
$font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color  
            

if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,50,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.9*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) ) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,17, 0, 60, 470, $font_color3, $fontX, $text); //Write 
 
 
$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=30)) ;
$y = (250 - $txt_height) / 2;
$x = (200 - $txt_width) / 2;

$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


 
imagettftext($background,$font_size, 0, $x1, 585, $font_color2, $fontY, $user2); //Write 
 

 
 


return $background; 
	
	
}

 
 function gd_filter_funky($background)
{ 
 
$background = gd_apply_overlay($background, 'funky', 100);
 
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/mathilde.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/MarketingScript-Shadow.ttf'; //font used
$font_color = imagecolorallocate($background,   0, 0, 0); // Create blue color 
$font_color2 = imagecolorallocate($background,   0, 0, 0); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color 
$font_color4 = imagecolorallocate($background,  89, 89,89); // Create blue color  
            
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,36,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.75*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) ) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,40, 0, 30, 160, $font_color3, $fontX, $text); //Write 
 
 
$font_size = 30;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-35;


$dimensions = imagettfbbox($font_size, 0, $fontZ, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;

imagettftext($background,$font_size, 0, $x1, 50, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, $x2, 85, $font_color4, $fontZ,$slug ); //Write 
 
 
   
$dimensions = imagettfbbox(30, 0, $fontW, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;


imagettftext($background,30, 0, $x2, 560, $font_color, $fontW, $user3); 


return $background; 
	
	
}
 function gd_filter_coolblue($background)
{ 
 

  if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
$moodswing2 =strtolower($moodswing2);

$hasPicture = verifyStartag();

if (empty($moodswing2))
{
	
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'coolblue', 100);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'coolblue2', 100);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'coolblue2', 100);}
}
else
{
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -50);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'coolblue2', 100);
	$background = gd_apply_overlay($background, 'shadow', 100);
}
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/Yellowtail-Regular.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255,255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color 
$font_color4 = imagecolorallocate($background,  255, 255,255); // Create blue color  
            
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,40,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) ) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;



 
imagettftext($background,25, 0, 20, $y, $font_color3, $fontX, $text); //Write 





if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  }
$font = 'assets/fonts/MyriadPro-Semibold.otf';
//font size
$font_size = 10;
//image width
$width = 100;
//text margin
$margin = 5;

//explode text by words
$text_a = explode(' ', $text);
$text_new = '';
foreach($text_a as $word){
    //Create a new text, add the word, and calculate the parameters of the text
    $box = imagettfbbox($font_size, 0, $font, $text_new.' '.$word);
    //if the line fits to the specified width, then add the word with a space, if not then add word with new line
    if($box[2] > $width - $margin*2){
        $text_new .= "\n".$word;
    } else {
        $text_new .= " ".$word;
    }
}
//trip spaces
$text_new = trim($text_new);
//new text box parameters
$box = imagettfbbox($font_size, 0, $font, $text_new);
//new text height
$height = $box[1] + $font_size + $margin * 2;
/*imagettftext($background, $font_size, 0, $margin, $font_size+$margin, $font_color3, $font, $text_new);*/




 
 
$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=40)) ;
$y = (250 - $txt_height) / 2;
$x = (200 - $txt_width) / 2;

$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox($font_size-5, 0, $fontZ, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,$font_size, 0, $x1, 40, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size-5, 0, $x2, 70, $font_color4, $fontZ,$slug ); //Write 

 





return $background; 
	
	
}
function gd_filter_punch($background)
{ 
 
$background = gd_apply_overlay($background, 'punch', 100);
 
 
$fontY = 'assets/fonts/Montserrat-Bold.ttf'; //font used
$fontX = 'assets/fonts/hand-of-sean_0.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$font_color = imagecolorallocate($background,   89,89,89); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  204, 0,1); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,36,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=20)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 30, 280, $font_color3, $fontX, $text); //Write 






$font_size = 30;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-35;


$dimensions = imagettfbbox($font_size, 0, $fontZ, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;

imagettftext($background,$font_size, 0, $x1, 40, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, $x2, 75, $font_color3, $fontZ,$slug ); //Write 
 
imagettftext($background,20, 0, 20, 580, $font_color2, $fontX, $slug); 
   

 
return $background; 
	
	
}

function gd_filter_trends($background)
{ 
 
$background = gd_apply_overlay($background, 'trends', 100);
 
$picme=profilepicture();
if(!empty($picme)) 
{
$x =451; $y=449; $w=116; $h=116; 
$background = gd_apply_logo($background, $picme, 100,$x,$y,$w,$h);
} 
 
$fontY = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/BebasNeue.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/OpenSans-Light.ttf'; //font used
$font_color = imagecolorallocate($background,   89,89,89); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  127, 172,226); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,34,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,30, 0, 27, 240, $font_color3, $fontX, $text); //Write 






$font_size = 30;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
 $bio      =  bio() ;

imagettftext($background,12, 0, 27, 150, $font_color3, $fontW, $user3); //Write 
imagettftext($background,12, 0, 27, 170, $font_color3, $fontY,$bio ); //Write 
 
imagettftext($background,12, 0, 20, 570, $font_color3, $fontW, $user2); 
   

 
return $background; 
	
	
}
function gd_filter_smart($background)
{ 
 
$background = gd_apply_overlay($background, 'smart', 100);
 
 
$fontY = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used
$fontX = 'assets/fonts/OpenSans-CondLightItalic.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/OpenSans-Light.ttf'; //font used
$font_color = imagecolorallocate($background,   70,70,70); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  127, 172,226); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,25,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.95*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=18)) ;
$y = (600 - $txt_height) / 2;
$x = (390 - $txt_width) / 2;
 
imagettftext($background,18, 0, 390, $y, $font_color, $fontX, $text); //Write 




$font_size = 30;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
 $bio      =  bio() ;

imagettftext($background,16, 0, 40, 530, $font_color, $fontW, $user3); //Write 
imagettftext($background,16, 0, 40, 550, $font_color, $fontY,$bio ); //Write 

$dimensions = imagettfbbox(14, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;
 

imagettftext($background,14, 0, $x1, 40, $font_color2, $fontY, $user2); //Write    

 
return $background; 
	
	
}


function gd_filter_nairobi($background)
{ 
 

 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 
if (empty($moodswing2))
{
  $hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { 
$background = gd_apply_overlay($background, 'nairobi', 100);
$font_color = imagecolorallocate($background,  255, 255, 255); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  255, 255, 255); // Create blue color  
}
if (!empty($hasPicture)) { 
$background = gd_apply_overlay($background, 'black', 50);
$font_color = imagecolorallocate($background,  255, 255, 255); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  255, 255, 255); // Create blue color  
}
if (!empty($_GET['cl'])) {  
$background = gd_apply_overlay($background, 'black', 50); 
$font_color = imagecolorallocate($background,  255, 255, 255); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  255, 255, 255); // Create blue color  
}
 
}
else{
imagefilter($background, IMG_FILTER_BRIGHTNESS, -60);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'shadow', 100);}

 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/KTF-Roadbrush_0.ttf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/Jellyka_Estrya_Handwriting_0.ttf'; //font used
 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,36,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=20)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 50, $y, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=35)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox($font_size-3, 0, $fontZ, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,$font_size, 0, $x1, 40, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size-3, 0, $x2, 70, $font_color3, $fontZ,$slug ); //Write 
 
imagettftext($background,80, 0, 20, 580, $font_color3, $fontW, $user3);
 
 
 $bio      =  bio()  ;
 imagettftext($background,7, 0,20, 590, $font_color3, $fontX, $bio);  

 
return $background; 
	
	
}

function gd_filter_nairobi2($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
  $hasPicture = verifyStartag();

/*if (empty($moodswing2))
{
	
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'twitter', 90);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'twitter2', 100);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'twitter2', 100);}
}

*/
if (empty($moodswing2) )
{
  $hasPicture = verifyStartag(); 
if (empty($_GET['cl']) && empty($hasPicture)) { 
$background = gd_apply_overlay($background, 'nairobi2', 100);
$font_color = imagecolorallocate($background,  255, 255, 255); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  255, 255, 255); // Create blue color  
}
if (!empty($hasPicture)) { 
$background = gd_apply_overlay($background, 'white', 90);
$font_color = imagecolorallocate($background,  0, 0, 0); // Create blue color 
$font_color3 = imagecolorallocate($background,   0, 0, 0); // Create blue color  
$font_color2 = imagecolorallocate($background,  0, 0, 0); // Create blue color  
}
if (!empty($_GET['cl'])) {  
$background = gd_apply_overlay($background, 'white', 90); 
$font_color = imagecolorallocate($background,  0, 0, 0); // Create blue color 
$font_color3 = imagecolorallocate($background,   0, 0, 0); // Create blue color  
$font_color2 = imagecolorallocate($background,  0, 0, 0); // Create blue color  
}
 

 
}



 
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/Russo.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/Jellyka_Estrya_Handwriting_0.ttf'; //font used
 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,32,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=16)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 40, $y, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = ucwords(user()); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=35)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

$dimensions = imagettfbbox($font_size, 0, $fontY, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x1 = 600 - $textWidth-20;


$dimensions = imagettfbbox($font_size-3, 0, $fontZ, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20;

imagettftext($background,$font_size, 0, $x1, 40, $font_color2, $fontY, $user2); //Write 
imagettftext($background,$font_size-3, 0, $x2, 70, $font_color3, $fontZ,$slug ); //Write 
 
imagettftext($background,80, 0, 20, 585, $font_color3, $fontW, $user3);
 
 
 $bio      =  bio()  ;
 imagettftext($background,7, 0,20, 585, $font_color3, $fontX, $bio);  
   

 
return $background; 
	
	
}
function get_startags($string, $str = 1) {
 preg_match_all('/\*(\w+)/',$string,$matches);
  $i = 0;
  if ($str) {
   foreach ($matches[1] as $match) {
   $count = count($matches[1]);
   $keywords .= "$match";
    $i++;
    if ($count > $i) $keywords .= ", ";
   }
  } else {
  foreach ($matches[1] as $match) {
  $keyword[] = $match;
  }
  $keywords = $keyword;
 }
return $keywords;
}
function get_spaces($string, $str = 10) {
 preg_match_all('/(\w+)/',$string,$matches);
  $i = 0;
  if ($str) {
   foreach ($matches[1] as $match) {
   $count = count($matches[1]);
   $keywords .= "$match";
    $i++;
    if ($count > $i) $keywords .= ", ";
   }
  } else {
  foreach ($matches[1] as $match) {
  $keyword[] = $match;
  }
  $keywords = $keyword;
 }
return $keywords;
}

function gd_filter_classic($background)
{ 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); ; 
  } 
$fontX = 'assets/fonts/TitilliumWeb-SemiBold_0.ttf'; //font used
$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 $hasPicture = verifyStartag();

/*if (empty($moodswing2))
{
	
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'twitter', 90);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'twitter2', 100);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'twitter2', 100);}
}

*/

if (empty($moodswing2)&& empty($hasPicture))
{
 $background = gd_apply_overlay($background, 'classic', 100);
 $font_color = imagecolorallocate($background,   252,206,96); // Create blue color 
 $fontX = 'assets/fonts/TitilliumWeb-SemiBold_0.ttf'; //font used
}
else
{
	
	
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
	imagefilter($background, IMG_FILTER_CONTRAST, -20);
	imagefilter($background, IMG_FILTER_GRAYSCALE);
	$background = gd_apply_overlay($background, 'black', 70);
  $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
 $fontX = 'assets/fonts/TitilliumWeb-SemiBold_0.ttf'; //font used
}
 if (!empty($_GET['cl']) || !empty($hasPicture)) { $font_color = imagecolorallocate($background,   252,206,96);}

$fontY = 'assets/fonts/Montserrat-Bold.ttf'; //font used
$fontZ = 'assets/fonts/Montserrat-Regular_0.ttf'; //font used
$fontC = 'assets/fonts/TitilliumWeb-Light.ttf'; //font used
$fontA = 'assets/fonts/TitilliumWeb-SemiBold_0.ttf'; //font used
$fontB = 'assets/fonts/TitilliumWeb-Regular_2.ttf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,36,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,20, 0, 30, $y, $font_color, $fontX, $text); //Write 






$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$user4      = "#".username(); 
$bio      = bio(); 

imagettftext($background,20, 0, 30, 50, $font_color2, $fontY, $user4); //Write 
imagettftext($background,10, 0, 30, 67, $font_color2, $fontZ,$bio ); //Write 

 
 $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);
 
 
 
 
 $dimensions = imagettfbbox(20, 0, $fontX, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 30; 
imagettftext($background,20, 0, $x2, 510, $font_color2, $fontX, $secondname); 


$dimensionsx = imagettfbbox(20, 0, $fontC, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+5; 
imagettftext($background,20, 0, $xx, 510, $font_color2, $fontC, $firstname); 
imagettftext($background,14, 0, 30, 528, $font_color2, $fontW, $secondname);    
imagettftext($background,12, 0, 30, 545, $font_color2, $fontY, $user2); //Write 
 
return $background; 


}


function gd_filter_royal($background)
{ 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
$fontX = 'assets/fonts/Corbert-Regular_0.otf'; //font used
$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
$hasPicture = verifyStartag();

 
if (empty($moodswing2))
{
 if (empty($_GET['cl'])  && empty($hasPicture)) { 
 $font_color4 = imagecolorallocate($background,  255, 255, 255);
 $background = gd_apply_overlay($background, 'royal', 100);
 
 }
 else
 {
	$background = gd_apply_overlay($background, 'royal', 50);
	 $font_color4 = imagecolorallocate($background,  207, 130,251);
 
	 imagefilter($background, IMG_FILTER_BRIGHTNESS, -20);
	imagefilter($background, IMG_FILTER_CONTRAST, -15); 
	 }
 $font_color = imagecolorallocate($background,   252,206,96); // Create blue color 
 $fontX = 'assets/fonts/Cabin-Regular_0.otf'; //font used
 $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
}
else
{
	
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
 $fontX = 'assets/fonts/Cabin-Regular_0.otf'; //font used
 $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
}


$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/Cabin-Bold_0.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,36,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,20, 0, 70, $y, $font_color, $fontX, $text); //Write 






$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$user4      = "#".username(); 
$bio      = bio(); 

imagettftext($background,30, 0, 70, 70, $font_color2, $fontZ, $user4); //Write 


$dimensions = imagettfbbox(10, 0, $fontA, $bio);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-50;
imagettftext($background,10, 0, $x2, 545, $font_color4, $fontA,$bio ); //Write 

 
 $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);
 
 
 
 
 $dimensions = imagettfbbox(20, 0, $fontY, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 70; 
imagettftext($background,20, 0, $x2, 510, $font_color2, $fontY, $secondname); 


$dimensionsx = imagettfbbox(20, 0, $fontY, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+5; 
imagettftext($background,20, 0, $xx, 510, $font_color2, $fontY, $firstname); 
imagettftext($background,14, 0, 70, 528, $font_color2, $fontW, $secondname);    
imagettftext($background,12, 0, 70, 545, $font_color2, $fontY, $user2); //Write 
 
return $background; 


}


function gd_filter_gaa($background)
{ 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
$fontX = 'assets/fonts/Corbert-Regular_0.otf'; //font used
$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
$hasPicture = verifyStartag();

 
if (empty($moodswing2))
{
 if (empty($_GET['cl'])  && empty($hasPicture)) { 
 $font_color4 = imagecolorallocate($background,  255, 255, 255);
 $background = gd_apply_overlay($background, 'gaafull', 100);
 
 }
 else
 {
	$background = gd_apply_overlay($background, 'gaaempty', 100);
	 $font_color4 = imagecolorallocate($background,  207, 130,251);
 
	 imagefilter($background, IMG_FILTER_BRIGHTNESS, -20);
	imagefilter($background, IMG_FILTER_CONTRAST, -15); 
	 }
 $font_color = imagecolorallocate($background,   252,206,96); // Create blue color 
 $fontX = 'assets/fonts/Cabin-Regular_0.otf'; //font used
 $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
}
else
{
	
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
 $fontX = 'assets/fonts/Cabin-Regular_0.otf'; //font used
 $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
}


$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/Cabin-Bold_0.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,36,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,20, 0, 70, $y, $font_color, $fontX, $text); //Write 






$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$user4      = "@mygovke"; 
$bio      = bio(); 

imagettftext($background,30, 0, 70, 70, $font_color2, $fontZ, $user4); //Write 



 
 
 
 
return $background; 


}


function gd_filter_sevens($background)
{ 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
$fontX = 'assets/fonts/Corbert-Regular_0.otf'; //font used
$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
$hasPicture = verifyStartag();

 
if (empty($moodswing2))
{
 if (empty($_GET['cl'])  && empty($hasPicture)) { 
 $font_color4 = imagecolorallocate($background,  255, 255, 255);
 
 $rand = rand(1,3);
  if ($rand==1){$background = gd_apply_overlay($background, 'sevensfull', 100);}
  if ($rand==2){$background = gd_apply_overlay($background, 'sevensempty', 100);}
   if ($rand==3){$background = gd_apply_overlay($background, 'sevensempty2', 100);}
 
 
 
 
 }
 else
 {
	 $rand = rand(1,3);
  if ($rand==1){$background = gd_apply_overlay($background, 'sevensfull', 100);}
  if ($rand==2){$background = gd_apply_overlay($background, 'sevensempty', 100);}
   if ($rand==3){$background = gd_apply_overlay($background, 'sevensempty2', 100);}
 
	 $font_color4 = imagecolorallocate($background,  207, 130,251);
 
	 imagefilter($background, IMG_FILTER_BRIGHTNESS, -20);
	imagefilter($background, IMG_FILTER_CONTRAST, -15); 
	 }
 $font_color = imagecolorallocate($background,   252,206,96); // Create blue color 
 $fontX = 'assets/fonts/Cabin-Regular_0.otf'; //font used
 $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
}
else
{
	
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
 $fontX = 'assets/fonts/Cabin-Regular_0.otf'; //font used
 $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
}


$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/Cabin-Bold_0.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,36,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,20, 0, 70, $y, $font_color, $fontX, $text); //Write 






$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
$user4      = "#Safari7s"; 
$bio      = bio(); 

imagettftext($background,30, 0, 70, 70, $font_color2, $fontZ, $user4); //Write 


/*$dimensions = imagettfbbox(10, 0, $fontA, $bio);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-50;
imagettftext($background,10, 0, $x2, 545, $font_color4, $fontA,$bio ); */ 

 
 $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);
 
 
 
 
 $dimensions = imagettfbbox(20, 0, $fontY, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 70; 
imagettftext($background,20, 0, $x2, 510, $font_color2, $fontY, $secondname); 


$dimensionsx = imagettfbbox(20, 0, $fontY, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+5; 
imagettftext($background,20, 0, $xx, 510, $font_color2, $fontY, $firstname); 
imagettftext($background,14, 0, 70, 528, $font_color2, $fontW, $secondname);    
imagettftext($background,12, 0, 70, 545, $font_color2, $fontY, $user2); //Write 
 
return $background; 


}


 



function gd_filter_yellow($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 


 
 

$myArray = get_startags($text, $str = 0);
$moodswing0 =$myArray[0];
$moodswing1 =$myArray[1];
 $moodswing0 =strtolower($moodswing0);
 $moodswing1 =strtolower($moodswing1);



 switch ($moodswing0) {
     
         case  "green" :
		 $font_color = imagecolorallocate($background,   64,64,64); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		$background = gd_apply_overlay($background, 'adgreen', 100);
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "red" :
			$font_color = imagecolorallocate($background,   64,64,64); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'adred', 100);
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "purple" :
		  $font_color = imagecolorallocate($background,   64,64,64); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'adpurple', 100);
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "yellow" :
		  $font_color = imagecolorallocate($background,   64,64,64); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'yellow', 100);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "blue" :
		 $font_color = imagecolorallocate($background,   64,64,64); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'adblue', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
         
		  case  "pink" :
		 $font_color = imagecolorallocate($background,   64,64,64); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'adpink', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
 }	

	
	
	

	
	
	switch ($moodswing1) {
     
         case  "green" :
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'adgreen', 50);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "red" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "purple" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "yellow" :
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "blue" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		   case  "pink" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'shadow', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		 
 }	















$fontX = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;



 $dimensions = imagettfbbox(26, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,25, 0, 70, $y, $font_color, $fontX, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 

     
imagettftext($background,10, 0, 70, 545, $font_color2, $fontZ, $bio); //Write 

$dimensions = imagettfbbox(10, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;
imagettftext($background,10, 0, $x2, 570, $font_color2, $fontZ, $slug); //Write 
 
 
  $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

$dimensions = imagettfbbox(30, 0, $fontZ, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 70; 

$arSize = imagettfbbox(25, 0, $fontX, $text);
$iWidth = abs($arSize[2] - $arSize[0]);
$iHeight = abs($arSize[7] - $arSize[1]);


imagettftext($background,30, 0, $x2, $y+$iHeight+40, $font_color, $fontZ, $secondname); 


$dimensionsx = imagettfbbox(30, 0, $fontX, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+10; 
imagettftext($background,30, 0, $xx, $y+$iHeight+40, $font_color, $fontX, $firstname); 
imagettftext($background,14, 0, 70, 528, $font_color2, $fontW, $secondname);  
imagettftext($background,20, 0, 70, 500, $font_color2, $fontZ, $user2);  
/* imagettftextSp($background, 30, 0, 70, 200, $font_color2, $fontY, $text, 23);*/
return $background; 


}


function gd_filter_coolpost($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText();
  } 
 $picme=profilepicture();
if(!empty($picme)) 
{
$x =20; $y=20; $w=250; $h=250; 
$background = gd_apply_logo($background, $picme, 100,$x,$y,$w,$h);
}

 
 $background = gd_apply_overlay($background, 'coolpost', 100);  


$fontX = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontY = 'assets/fonts/Roboto-Light_2.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   67, 74, 84); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,35,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=20)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y+10;



 $dimensions = imagettfbbox(20, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,20, 0, 40, 325, $font_color2, $fontX, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 

     
 

$dimensions = imagettfbbox(10, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;
imagettftext($background,10, 0, 40, 570, $font_color2, $fontZ, $slug); //Write 
 
 
  $user3      = user();
$dimensions = imagettfbbox(20, 0, $fontY, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,20, 0, $x2, 130, $font_color3,$fontY, $user3); 


 
$dimensions = imagettfbbox(20, 0, $fontZ, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,20, 0, $x2, 160, $font_color3,$fontZ, $user2); 



imagettftext($background,14, 0, 70, 528, $font_color2, $fontW, $secondname);  
 
return $background; 


}

function gd_filter_glassy($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  }
  
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -80);
 $background = gd_apply_effect($background, 'glitter', 100); 
	  
    $background = gd_apply_overlay($background, 'glassy', 100);  
$fontX = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontY = 'assets/fonts/Roboto-Light_2.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   67, 74, 84); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,50,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=15)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y+10;



 $dimensions = imagettfbbox(20, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,15, 0, 50, 325, $font_color3, $fontX, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 

     
 

/*$dimensions = imagettfbbox(10, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;
imagettftext($background,10, 0, 40, 560, $font_color3, $fontZ, $slug);*/ //Write 
 
 
  $user3      = user();

imagettftext($background,14, 0, 32, 75, $font_color3,$fontY, $user3); 



imagettftext($background,24, 0, 32, 55 , $font_color3,$fontZ, $user2); 



imagettftext($background,14, 0, 70, 528, $font_color2, $fontW, $secondname);  
 
return $background; 


}

function gd_filter_followme($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
 $picme=profilepicture();
if(!empty($picme)) 
{
$x =20; $y=20; $w=250; $h=250; 
$background = gd_apply_logo($background, $picme, 100,$x,$y,$w,$h);
}

 
 $background = gd_apply_overlay($background, 'followme', 100);  


$fontX = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontY = 'assets/fonts/Roboto-Light_2.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Roboto-Medium_0.ttf'; //font used

$font_color2 = imagecolorallocate($background,   152, 159, 169); // Create blue color  
$font_color3 = imagecolorallocate($background,  214, 215,220); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,24,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=15)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y+10;



 $dimensions = imagettfbbox(15, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,15, 0, 315, 150, $font_color2, $fontY, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 

     
 

$dimensions = imagettfbbox(10, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;
imagettftext($background,10, 0, 40, 570, $font_color2, $fontZ, $slug); //Write 
 
 
  $user3      = user();

imagettftext($background,20, 0, 315, 80, $font_color2,$fontW, $user3); 


 
$dimensions = imagettfbbox(25, 0, $fontZ, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,15, 0, 315, 100, $font_color3,$fontZ, $user2); 



imagettftext($background,14, 0, 70, 528, $font_color2, $fontW, $secondname);  
 
return $background; 


}

function gd_filter_orange($background)
{ 
 
  if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
$moodswing2 =strtolower($moodswing2);

$hasPicture = verifyStartag();

if (empty($moodswing2))
{
	
if (empty($_GET['cl']) && empty($hasPicture)) {  $background = gd_apply_overlay($background, 'orange', 100); }
if (!empty($hasPicture)) {  $background = gd_apply_overlay($background, 'orange', 100); }
if (!empty($_GET['cl'])) {  $background = gd_apply_overlay($background, 'orange', 100); }
}
else
{
			  imagefilter($background, IMG_FILTER_GRAYSCALE);
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -90);
	imagefilter($background, IMG_FILTER_CONTRAST, -20);
	
	 
}

 
 


$fontX = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used
$fontY = 'assets/fonts/Roboto-Light_2.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-Bold_0.ttf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used

$font_color2 = imagecolorallocate($background,   250, 96, 6); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
$font_color4 = imagecolorallocate($background,  0, 0,0); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,24,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox(25,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y+10;



 $dimensions = imagettfbbox(25, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,25, 0, 25, 65, $font_color2, $fontX, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = strtoupper($user2);
$slug      = "startag.co/".slug();
$user4      = "#".username(); 
$user4      = strtoupper($user4);
$bio      = strtoupper(bio()); 
 
 
 
  $user3      = user();

imagettftext($background,20,90, 570, 590, $font_color4,$fontX, $slug); 



imagettftext($background,15, 90, 590, 590, $font_color3,$fontX, $user4); 




 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

$dimensions = imagettfbbox(30, 0, $fontZ, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 25; 

$arSize = imagettfbbox(30, 0, $fontX, $text);
$iWidth = abs($arSize[2] - $arSize[0]);
$iHeight = abs($arSize[7] - $arSize[1]);


imagettftext($background,25, 0, $x2, 50+$iHeight+40, $font_color3, $fontX, $secondname); 


$dimensionsx = imagettfbbox(25, 0, $fontX, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+2; 
imagettftext($background,25, 0, $xx,50+$iHeight+40, $font_color3, $fontX, $firstname); 
 

 
return $background; 


}
function gd_filter_safaricom($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText();
  } 


 
 

$myArray = get_startags($text, $str = 0);
$moodswing0 =$myArray[0];
$moodswing1 =$myArray[1];
 $moodswing0 =strtolower($moodswing0);
 $moodswing1 =strtolower($moodswing1);

 if ($moodswing1=="safaricomcare" || $moodswing0 =="safaricomcare") {
	  
	  
$picme = rand(1,8);
if($picme == 1) {$image ="1.jpg"; } 
if($picme == 2) { $image ="2.jpg"; } 
if($picme == 3) { $image ="3.jpg";  } 
if($picme == 4) {$image ="4.jpg";  } 
if($picme == 5) { $image ="5.jpg"; } 
if($picme == 6) { $image ="6.jpg"; } 
if($picme == 7) { $image ="7.jpg"; } 
if($picme == 8) { $image ="8.jpg";  } 
if($picme == 8) { $image ="9.jpg";  } 
 
   	  
 $background = gd_apply_overlay6($background, $image, 100);	  
 
	}

 switch ($moodswing0) {
     
         case  "shangwemtaani" :
		 $font_color = imagecolorallocate($background,    0, 0, 0); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		$background = gd_apply_overlay($background, 'shangwemtaani', 100);
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "teammafisi" :
			$font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'teammafisi', 100);
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "thisisforyou" :
		  $font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'thisisforyou', 100);
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "mpesa" :
		  $font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'mpesa', 100);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "suzziemaselfie" :
		 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'suzziemaselfie', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
         
		  case  "safaricomcare" :
		 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'safaricomcare', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
 }	

	
	
	

	
	
	switch ($moodswing1) {
     
         case  "shangwemtaani" :
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'shangwemtaani', 50);
 
 $font_color = imagecolorallocate($background,   0, 0, 0); // Create blue color 
  $font_color4 = imagecolorallocate($background,  0, 0, 0); // Create blue color
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "teammafisi" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'teammafisi', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "thisisforyou" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'thisisforyou', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "mpesa" :
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'mpesa', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "suzziemaselfie" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'suzziemaselfie', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		   case  "safaricomcare" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'safaricomcare', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		 
 }	


  $fontC = 'assets/fonts/GOTHICB_0.TTF'; //font used
 $fontB = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
 $fontA = 'assets/fonts/MyriadWebPro-Italic_0.ttf'; //font used
$fontY = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-LtCnO.otf'; //font used
$fontW = 'assets/fonts/HelveticaLTStd-BlkCondObl.otf'; //font used
$font_color = imagecolorallocate($background,   255,223,67); // Create blue color 
$font_color2 = imagecolorallocate($background,   0, 0, 0); // Create blue color  
$font_color3 = imagecolorallocate($background, 136,184,20); // Create blue color  






/*   */







if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
  
  
 
$text = removeslashes($text);
$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = ucwords(username()); 
$user3      = strtoupper(user()); 
$slug      = "startag.co/".slug();

 


 
$dimensions = imagettfbbox(12, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-15; 

 


preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 






  if ($moodswing1=="safaricomcare" || $moodswing0 =="safaricomcare") {
	     
	  
 $yme = 445;	    
  $xme = 445;
  $yme2 = 40;
  $xme2 = 160;
  $yme3 = 445;
  
  
  
  $text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontC,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=18)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;

   imagettftext($background,$font_size, 0, $x, $y, $font_color3, $fontC, $text); //Write 
  
}
else
{
$yme = 585;	
 $xme = 0;
 $yme2 = 585;

 $xme2 = 28;
 $yme3 = 490;
 imagettftext($background,20, 0, 28, 95, $font_color2, $fontA, $user2); //Write 
 
 imagettftext($background,12, 0, $x2, $yme2, $font_color2, $fontY, $slug); 
imagettftext($background,14, 0, 28,$yme2, $font_color2, $fontY,  "*".username()); 

  $text = wordwrap($text,26,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.9*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=22)) ;
$y = (600 - $txt_height) / 2;
$x = (300 - $txt_width) / 2;
 imagettftext($background,$font_size, 0, 35, $y, $font_color3, $fontZ, $text); //Write 
	
	}








 
  $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

$dimensions = imagettfbbox(20, 0, $fontZ, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = $xme2; 

$arSize = imagettfbbox(30, 0, $fontZ, $text);
$iWidth = abs($arSize[2] - $arSize[0]);
$iHeight = abs($arSize[7] - $arSize[1]);


imagettftext($background,20, 0, $x2, $yme3, $font_color2, $fontZ, $secondname); 


$dimensionsx = imagettfbbox(20, 0, $fontB, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+5; 
 
 imagettftext($background,20, 0, $xx, $yme3, $font_color2, $fontB, $firstname);  

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
  if ($moodswing1=="safaricomcare" || $moodswing0 =="safaricomcare") {
   $picme="9.jpg";
   if ($picme=="9.jpg") {
		
		$background = gd_apply_overlay6($background, $picme, 100);	
		
		}	
	 }
 	  
 
 
 
 
 
 
return $background; 


}



function gd_filter_gaame($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 


 
 

$myArray = get_startags($text, $str = 0);
$moodswing0 =$myArray[0];
$moodswing1 =$myArray[1];
 $moodswing0 =strtolower($moodswing0);
 $moodswing1 =strtolower($moodswing1);

 if ($moodswing1=="safaricomcare" || $moodswing0 =="safaricomcare") {
	  
	  
$picme = rand(1,8);
if($picme == 1) {$image ="1.jpg"; } 
if($picme == 2) { $image ="2.jpg"; } 
if($picme == 3) { $image ="3.jpg";  } 
if($picme == 4) {$image ="4.jpg";  } 
if($picme == 5) { $image ="5.jpg"; } 
if($picme == 6) { $image ="6.jpg"; } 
if($picme == 7) { $image ="7.jpg"; } 
if($picme == 8) { $image ="8.jpg";  } 
if($picme == 8) { $image ="9.jpg";  } 
 
  $font_color6 = imagecolorallocate($background,  201, 201,201); // Create blue color  	  
 $background = gd_apply_overlay6($background, $image, 100);	  
 
	}

 switch ($moodswing0) {
     
         case  "gaasimple" :
		 $font_color = imagecolorallocate($background,    0, 0, 0); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		$background = gd_apply_overlay($background, 'gaasimple', 100);
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color   
          break; 
		    case  "gaasocial" :
			$font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'gaasocial', 100);
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "gaaclean" :
		  $font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'gaaclean', 100);
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "gaacool" :
		  $font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'gaacool', 100);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "gaa5" :
		 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'gaa5', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
         
		  case  "gaa6" :
		 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'gaa6', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
 }	

	
	
	

	
	
	switch ($moodswing1) {
     
         case  "gaasimple" :
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'gaasimple', 100);
 
 $font_color = imagecolorallocate($background,   0, 0, 0); // Create blue color 
  $font_color4 = imagecolorallocate($background,  0, 0, 0); // Create blue color
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "gaasocial" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'gaasocial',100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "gaaclean" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'gaaclean', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "gaacool" :
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'gaacool', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "gaa5" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'gaa5', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		   case  "gaa6" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'gaa6', 100);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		 
 }	


  $fontC = 'assets/fonts/GOTHICB_0.TTF'; //font used
 $fontB = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
 $fontA = 'assets/fonts/MyriadWebPro-Italic_0.ttf'; //font used
$fontY = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-LtCnO.otf'; //font used
$fontW = 'assets/fonts/HelveticaLTStd-BlkCondObl.otf'; //font used
$font_color = imagecolorallocate($background,   255,223,67); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background, 136,184,20); // Create blue color  







/*   */







if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
  
  
 
$text = removeslashes($text);
$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = ucwords(username()); 
$user3      = strtoupper(user()); 
$slug      = "startag.co/".slug();

 


 
$dimensions = imagettfbbox(12, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-15; 

 


preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 






  if ($moodswing1=="safaricomcare" || $moodswing0 =="safaricomcare") {
	     
	  
 $yme = 445;	    
  $xme = 445;
  $yme2 = 40;
  $xme2 = 160;
  $yme3 = 445;
  
  
  
  $text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontC,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=18)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;

   imagettftext($background,$font_size, 0, $x, $y, $font_color2, $fontC, $text); //Write 
  
}
else
{
$yme = 585;	
 $xme = 0;
 $yme2 = 585;

 $xme2 = 28;
 $yme3 = 490;

 
 imagettftext($background,12, 0, $x2, 30, $font_color2, $fontY, $slug); 
/*imagettftext($background,14, 0, 28,$yme2, $font_color2, $fontY,  "*".username()); */

  $text = wordwrap($text,26,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.9*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=22)) ;
$y = (600 - $txt_height) / 2;
$x = (300 - $txt_width) / 2;
 imagettftext($background,$font_size, 0, 35, $y, $font_color2, $fontZ, $text); //Write 
	
	}








 
  $user3      = "My Gov Kenya";
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

$dimensions = imagettfbbox(20, 0, $fontZ, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = $xme2; 

$arSize = imagettfbbox(30, 0, $fontZ, $text);
$iWidth = abs($arSize[2] - $arSize[0]);
$iHeight = abs($arSize[7] - $arSize[1]);


imagettftext($background,20, 0, $x2, $yme3, $font_color2, $fontZ, $secondname); 


$dimensionsx = imagettfbbox(20, 0, $fontB, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+5; 
 
 imagettftext($background,20, 0, $xx, $yme3, $font_color2, $fontB, $firstname);  

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
  if ($moodswing1=="safaricomcare" || $moodswing0 =="safaricomcare") {
   $picme="9.jpg";
   if ($picme=="9.jpg") {
		
		$background = gd_apply_overlay6($background, $picme, 100);	
		
		}	
	 }
 	  
 
 
 
 
 
 
return $background; 


}


function gd_filter_modern($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 


 
 

$myArray = get_startags($text, $str = 0);
$moodswing0 =$myArray[0];
$moodswing1 =$myArray[1];
 $moodswing0 =strtolower($moodswing0);
 $moodswing1 =strtolower($moodswing1);



 switch ($moodswing0) {
     
         case  "moderngreen" :
		 $font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		$background = gd_apply_overlay($background, 'adgreen', 100);
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "modernred" :
			$font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'adred', 100);
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "modernpurple" :
		  $font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'adpurple', 100);
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "modernyellow" :
		  $font_color = imagecolorallocate($background,    255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'yellow', 100);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "modernblue" :
		 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'adblue', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
         
		  case  "modernpink" :
		 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  207, 130,251); // Create blue color
		 $background = gd_apply_overlay($background, 'modernpink', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
 }	

	
	
	

	
	
	switch ($moodswing1) {
     
         case  "moderngreen" :
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	$background = gd_apply_overlay($background, 'adgreen', 50);
 
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "modernred" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'adred', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "modernpurple" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'adpurple', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "modernyellow" :
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'adyellow', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "modernblue" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'adblue', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		   case  "modernpink" :
		 imagefilter($background, IMG_FILTER_BRIGHTNESS, -40);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
	 $background = gd_apply_overlay($background, 'modernpink', 50);
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		 
 }	















$fontX = 'assets/fonts/OpenSans-Light.ttf'; //font used
$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,25,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;



 $dimensions = imagettfbbox(25, 0, $fontZ, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,25, 0, 40, $y, $font_color, $fontZ, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 

     
imagettftext($background,10, 90,580, 580, $font_color2, $fontZ, $bio); //Write 

$dimensions = imagettfbbox(10, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;
imagettftext($background,10, 90,560, 580, $font_color2, $fontZ, $slug); //Write 
 
 
  $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

$dimensions = imagettfbbox(25, 0, $fontZ, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 40; 

$arSize = imagettfbbox(25, 0, $fontX, $text);
$iWidth = abs($arSize[2] - $arSize[0]);
$iHeight = abs($arSize[7] - $arSize[1]);


imagettftext($background,25, 0, $x2, $y+$iHeight+100, $font_color3, $fontZ, $secondname); 


$dimensionsx = imagettfbbox(25, 0, $fontX, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+10; 
imagettftext($background,25, 0, $xx, $y+$iHeight+100, $font_color3, $fontX, $firstname); 
imagettftext($background,20, 0, 40, 570, $font_color2, $fontW, $secondname);  
imagettftext($background,20, 90, 540, 580, $font_color3, $fontZ, $user2);  
/* imagettftextSp($background, 30, 0, 70, 200, $font_color2, $fontY, $text, 23);*/
return $background; 


}

function gd_filter_classy($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText();
  } 

 $background = gd_apply_overlay($background, 'classy', 100);
 
 
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
   
$fontX = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-HvCn.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  203, 32,42); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,35,"\n");
 
$font_size = 1;
$txt_max_width = intval(600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=22)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-50;



 $dimensions = imagettfbbox(22, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,22, 0, 70, 360, $font_color, $fontX, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3     = "-".strtoupper(user()); 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 

     



$font_size = 1;
$txt_max_width = intval(0.7*600);
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=12)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;



imagettftext($background,$font_size, 0, $x, 50, $font_color, $fontZ, $user2);  

$font_size = 1;
$txt_max_width = intval(0.7*600);
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$user3);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=12)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;


imagettftext($background,$font_size, 0, $x, 560, $font_color, $fontZ, $user3); //Write 

/* imagettftextSp($background, 30, 0, 70, 200, $font_color2, $fontY, $text, 23);*/
return $background; 


}


function gd_filter_impact($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

 $background = gd_apply_overlay($background, 'impact', 100);
 
 
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
   
$fontX = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-HvCn.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  203, 32,42); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-50;



 $dimensions = imagettfbbox(26, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,25, 0, 70, $y, $font_color, $fontX, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3     = strtoupper(user()); 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 

     
/*imagettftext($background,10, 0, 70, 545, $font_color2, $fontZ, $bio);*/ //Write 

$dimensions = imagettfbbox(14, 0, $fontZ, $user3);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-10;
imagettftext($background,14, 0, $x2, 588, $font_color3, $fontZ, $user3); //Write 




 

 
 
 
/* $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

$dimensions = imagettfbbox(30, 0, $fontZ, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 70; 

$arSize = imagettfbbox(25, 0, $fontX, $text);
$iWidth = abs($arSize[2] - $arSize[0]);
$iHeight = abs($arSize[7] - $arSize[1]);


imagettftext($background,30, 0, $x2, $y+$iHeight+40, $font_color, $fontZ, $secondname); 


$dimensionsx = imagettfbbox(30, 0, $fontX, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+10; 
imagettftext($background,30, 0, $xx, $y+$iHeight+40, $font_color, $fontX, $firstname); 
imagettftext($background,14, 0, 70, 528, $font_color2, $fontW, $secondname);  */






$font_size = 1;
$txt_max_width = intval(0.7*600);
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=12)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;



imagettftext($background,$font_size, 0, $x, 438, $font_color2, $fontZ, $user2);  
/* imagettftextSp($background, 30, 0, 70, 200, $font_color2, $fontY, $text, 23);*/
return $background; 


}
function gd_filter_exquisite($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText();
  } 

 $background = gd_apply_overlay($background, 'exquisite', 100);
 
 
 $font_color = imagecolorallocate($background,   101, 98, 97); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
   
$fontX = 'assets/fonts/Pacifico.ttf'; //font used
$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-HvCn.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  7, 4,6); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,35,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;


 $dimensions = imagettfbbox(26, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,25, 0, 70+1, $y+1, $font_color3, $fontX, $text); 

imagettftext($background,25, 0, 70, $y, $font_color, $fontX, $text);   

  
  

$font_size = 25;
$user2      = "*".username(); 
$user3     =  user() ; 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio());  


$font_size = 1;
$txt_max_width = intval(0.7*600);
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$user3);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=18)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;


imagettftext($background,$font_size, 0, $x+1, 535+1, $font_color3, $fontX, $user3); 
imagettftext($background,$font_size, 0, $x, 535, $font_color, $fontX, $user3); 
 
//Write 
 
/* imagettftextSp($background, 30, 0, 70, 200, $font_color2, $fontY, $text, 23);*/
return $background; 


}
 
function gd_filter_notice($background)
{ 
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text =dummyText();
  } 

 $background = gd_apply_overlay($background, 'notice', 100);
 
 
 $font_color = imagecolorallocate($background,   101, 98, 97); // Create blue color 
  $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
   
$fontX = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-HvCn.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  203, 32,42); // Create blue color  


 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=30)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-300;



 $dimensions = imagettfbbox(26, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,20, 0, 70, 270, $font_color, $fontX, $text); //Write 

$font_size = 25;
$user2      = "*".username(); 
$user3     = ucwords(user()); 
$slug      = strtoupper("startag.co/".slug());
$user4      = "#".username(); 
$bio      = strtoupper(bio());  


$font_size = 1;
$txt_max_width = intval(0.7*600);
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontW,$user3);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=20)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;



imagettftext($background,$font_size, 0, $x, 470, $font_color, $fontW, $user3); 
$font_size = 1;
$txt_max_width = intval(600);
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$user3);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=15)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 $y = $y-100;


imagettftext($background,15, 0, $x , 206, $font_color, $fontZ, $user3); //Write 
 
/* imagettftextSp($background, 30, 0, 70, 200, $font_color2, $fontY, $text, 23);*/
return $background; 


}

function gd_filter_calmgreen($background)
{ 
 
	
imagefilter($background, IMG_FILTER_BRIGHTNESS, -25);
	imagefilter($background, IMG_FILTER_CONTRAST, -10);
	 $background = gd_apply_overlay($background, 'shadow', 100);
	
	 
	 	
 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing0 =$myArray[0];
$moodswing1 =$myArray[1];
 $moodswing0 =strtolower($moodswing0);
 $moodswing1 =strtolower($moodswing1);

  $startag =findStartag($moodswing0);
 $startag = explode('|',$startag);
 $themes = $startag[1];
 if (!empty($themes)) {$moodswing0 =strtolower($themes); }






 switch ($moodswing0) {
     
         case  "calmgreen" :
		if (!empty($themes)) 
		{
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -20);
		imagefilter($background, IMG_FILTER_CONTRAST, -5);
		 
		}
		$background = gd_apply_overlay($background, 'calmgreen', 100);
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "calmred" :
		if (!empty($themes)) 
		{
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -20);
		imagefilter($background, IMG_FILTER_CONTRAST, -5);
		 
		}
		 $background = gd_apply_overlay($background, 'calmred', 100);
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "calmpurple" :
		if (!empty($themes)) 
		{
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -20);
		imagefilter($background, IMG_FILTER_CONTRAST, -5);
	 
		}
		 $background = gd_apply_overlay($background, 'calmpurple', 100);
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "calmyellow" :
		if (!empty($themes)) 
		{
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -20);
		imagefilter($background, IMG_FILTER_CONTRAST, -5);
	 
		}
		 $background = gd_apply_overlay($background, 'calmyellow', 100);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "calmblue" :
		if (!empty($themes)) 
		{
		imagefilter($background, IMG_FILTER_BRIGHTNESS, -20);
		imagefilter($background, IMG_FILTER_CONTRAST, -5);
		 
		}
		 $background = gd_apply_overlay($background, 'calmblue', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		 
 }	

	switch ($moodswing1) {
     
         case  "calmgreen" :
		$background = gd_apply_overlay($background, 'calmgreen', 100);
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "calmred" :
		 $background = gd_apply_overlay($background, 'calmred', 100);
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "calmpurple" :
		 $background = gd_apply_overlay($background, 'calmpurple', 100);
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "calmyellow" :
		 $background = gd_apply_overlay($background, 'calmyellow', 100);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "calmblue" :
		 $background = gd_apply_overlay($background, 'calmblue', 100);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		 
 }	

	
	
	
	
	
	
	
	
	

 
 $fontX = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used
$fontY = 'assets/fonts/Cabin-Medium_0.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/HelveticaNeueLTStd-ThCn.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
 
 $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  



 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,45,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 



 $dimensions = imagettfbbox(26, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,18, 0, 38, 425, $font_color, $fontB, $text); //Write 


$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = slug();
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 



/*$dimensions = imagettfbbox(15, 0, $fontB, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;
imagettftext($background,15, 0, $x2, 570, $font_color, $fontB, $slug); //Write */
 
 
  $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

$dimensions = imagettfbbox(30, 0, $fontZ, $secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 38; 
imagettftext($background,30, 0, $x2, 400, $font_color3, $fontZ, $secondname); 


$dimensionsx = imagettfbbox(30, 0, $fontX, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+10; 
imagettftext($background,30, 0, $xx, 400, $font_color, $fontZ, $firstname); 


imagettftext($background,14, 0, 38, 575, $font_color2, $fontW, $secondname);  
imagettftext($background,20, 0, 38, 555, $font_color2, $fontZ, $user2);  



 
 
 
 
 $dimensions = imagettfbbox(15, 0, $fontB, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,15, 0, $x2, 575, $font_color3, $fontB, $slug); 


$dimensionsx = imagettfbbox(15, 0, $fontB, "startag.co/");
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 - $textWidthx; 
imagettftext($background,15, 0, $xx, 575, $font_color2, $fontB, "startag.co/"); 












return $background; 


}


function gd_filter_adgreen($background)
{ 
 
	
imagefilter($background, IMG_FILTER_BRIGHTNESS, -25);
	imagefilter($background, IMG_FILTER_CONTRAST, -10);
	 $background = gd_apply_overlay($background, 'shadow', 100);
	
	 
	 	
 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing0 =$myArray[0];
$moodswing1 =$myArray[1];
$moodeffect =$myArray[2];
 $moodswing0 =strtolower($moodswing0);
 $moodswing1 =strtolower($moodswing1);

 $startag =findStartag($moodswing0);
 $startag = explode('|',$startag);
 $themes = $startag[1];
 if (!empty($themes)) {$moodswing0 =strtolower($themes); }

if (!empty($_GET['cl']) || !empty($themes)) { $opacity = 70;} else { $opacity = 100;}
 switch ($moodswing0) {
     
         case  "adgreen" :
		$background = gd_apply_overlay($background, 'adgreen', $opacity);
		 $font_color3 = imagecolorallocate($background,  151, 204,74); // Create blue color  
          break; 
		    case  "adred" :
		 $background = gd_apply_overlay($background, 'adred', $opacity);
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "adpurple" :
		 $background = gd_apply_overlay($background, 'adpurple', $opacity);
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "adyellow" :
		 $background = gd_apply_overlay($background, 'adyellow', $opacity);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break; 
		   case  "adwhite" :
		  
		 $font_color3 = imagecolorallocate($background,  255, 255,255);
          break;
		  case  "adpink" :
		 $background = gd_apply_overlay($background, 'adpink', $opacity);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break;
         case  "adblue" :
		 $background = gd_apply_overlay($background, 'adblue', $opacity);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
         
 
 }	








	switch ($moodswing1) {
		
     
          case  "adgreen" :
		  imagefilter($background, IMG_FILTER_GRAYSCALE);
	imagefilter($background, IMG_FILTER_BRIGHTNESS, -15);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
		imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
		 $font_color3 = imagecolorallocate($background,  151, 204,90); // Create blue color  
          break; 
		    case  "adred" :
			imagefilter($background, IMG_FILTER_GRAYSCALE);
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
		 $background = gd_apply_overlay($background, 'adred', 90);
		 $font_color3 = imagecolorallocate($background,  228, 4,4);
          break;  
		  case  "adpurple" :
		  imagefilter($background, IMG_FILTER_GRAYSCALE);
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
		 $background = gd_apply_overlay($background, 'adpurple', 90);
		 $font_color3 = imagecolorallocate($background,  168, 100,168);
          break;
		  case  "adyellow" :
		  imagefilter($background, IMG_FILTER_GRAYSCALE);
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
		 $background = gd_apply_overlay($background, 'adyellow', 90);
		 $font_color3 = imagecolorallocate($background,  252, 195,59);
          break; 
		  
		  case  "adwhite" :
		  imagefilter($background, IMG_FILTER_GRAYSCALE);
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
		 
		 $font_color3 = imagecolorallocate($background,  255, 255,255);
          break;
		  case  "adpink" :
		  imagefilter($background, IMG_FILTER_GRAYSCALE);
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
		 $background = gd_apply_overlay($background, 'adpink', 90);
		 $font_color3 = imagecolorallocate($background,  252, 195,90);
          break;
         case  "adblue" :
		 imagefilter($background, IMG_FILTER_GRAYSCALE);
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
	imagefilter($background, IMG_FILTER_CONTRAST, -15);
		 $background = gd_apply_overlay($background, 'adblue', 90);
		 $font_color3 = imagecolorallocate($background,  15, 198,248);
          break;
		 
		   
 }	


	
	
	
	
	
	

 
 $fontX = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used
$fontY = 'assets/fonts/HelveticaNeueLTStd-LtEx.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used

$fontA = 'assets/fonts/Cabin-Regular_0.otf'; //font used
$fontB = 'assets/fonts/HelveticaNeueLTStd-ThCn.otf'; //font used
$fontW = 'assets/fonts/Autograf_PersonalUseOnly.ttf'; //font used
 $font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
 
 $font_color4 = imagecolorallocate($background,  255, 255, 255); // Create blue color
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  



 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,25,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.7*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 



 $dimensions = imagettfbbox(26, 0, $fontX, $text);
$textWidth = abs($dimensions[4] - $dimensions[3]);

imagettftext($background,25, 0, 45, $y, $font_color2, $fontZ, $text); //Write 


$font_size = 25;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = slug();
$user4      = "#".username(); 
$bio      = strtoupper(bio()); 



/*$dimensions = imagettfbbox(15, 0, $fontB, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-35;
imagettftext($background,15, 0, $x2, 570, $font_color, $fontB, $slug); //Write */
 
 
  $user3      = user();
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[1];
$secondname =ucwords($myArray[0]);

$dimensions = imagettfbbox(20, 0, $fontZ, "-".$secondname);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 38; 

$arSize = imagettfbbox(30, 0, $fontZ, $text);
$iWidth = abs($arSize[2] - $arSize[0]);
$iHeight = abs($arSize[7] - $arSize[1]);

 



imagettftext($background,20, 0, $x2, $y+$iHeight+40, $font_color2, $fontZ, "-".$secondname); 


$dimensionsx = imagettfbbox(20, 0, $fontY, $firstname);
$textWidthx = abs($dimensionsx[4] - $dimensionsx[0]);
$xx = $x2 + $textWidth+10; 
imagettftext($background,20, 0, $xx, $y+$iHeight+40, $font_color2, $fontY, $firstname); 
 


 


 

imagettftext($background,15, 0, 45, 55, $font_color2, $fontZ, $user2); 










return $background; 


}

function verifyStartag()
{
$text = realText() ; 
$myArray = get_startags($text, $str = 0);
$moodswing0 =$myArray[0];
$moodswing0 =strtolower($moodswing0);
$startag =findStartag($moodswing0);
$startag = explode('|',$startag);
return $picture = $startag[0];
}


function gd_filter_moodswing($background)
{ 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
 
$myArray = get_startags($text, $str = 0);
$moodswing0 =$myArray[0];
$moodswing1 =$myArray[1];
$moodswing2 =$myArray[2];
$moodswingX =$myArray[2];
$moodswing4 =$myArray[4];

$moodswing0 =strtolower($moodswing0);
$moodswing1 =strtolower($moodswing1);
$moodswing2 =strtolower($moodswing2);

$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text);

			if (empty($moodswing0))
			{
			 
						$startag =openGallery($moodswing0);
						if(!empty($startag))
						{
							$startag = explode('|',$startag);
							$picture = $startag[0];
							 
							$background = gd_apply_overlay4($background, $picture, 100);
							
							if(!empty($moodswingX))
							{ 
							    $moodswing2 = $moodswingX;
								include("mags/effects.php");
							}
							
							if(!empty($moodswing1))
							{
								$moods =strtolower($moodswing1);
							}
							else
							{
								$moods = $startag[1];
								$moods =strtolower($moods); 
							}
							
   
							switch ($moods) {
								case  "widgetstats" :
								  $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetstats2" :
								   $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetstats" :
								   $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetblue" :
								   $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetred" :
								  $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetgreen" :
								   $background= gd_filter_widget($background);
								  return $background;
								  break;
									 case  "classic" :
								  $background= gd_filter_classic($background);
								  return $background;
								  break;
								  case  "royal" :
								  $background= gd_filter_royal($background);
								  return $background;
								  break;
								  case  "yellow" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
								  case  "coolpost" :
								  $background= gd_filter_coolpost($background);
								  return $background;
								  break;

								  case  "glassy" :
								  $background= gd_filter_glassy($background);
								  return $background;
								  break;
								  case  "followme" :
								  $background= gd_filter_followme($background);
								  return $background;
								  break;

								  case  "orange" :
								  $background= gd_filter_orange($background);
								  return $background;
								  break;
								  case  "green" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
									
								   case  "blue" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
								   case  "red" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
									   case  "purple" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
									   case  "pink" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
								  case  "modernyellow" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
								  case  "moderngreen" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									
								   case  "modernblue" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
								   case  "modernred" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									   case  "modernpurple" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									   case  "modernpink" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;


								   case  "calmgreen" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
								   case  "calmyellow" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
								   case  "calmblue" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
								   case  "calmred" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
									   case  "calmpurple" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
									   case  "adgreen" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								   case  "adyellow" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								  case  "adwhite" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								   case  "adblue" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
							   
						   case  "adred" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								  
							 case  "impact" :
									$background= gd_filter_impact($background);
									return $background;
									break;
 case  "classy" :
        $background= gd_filter_classy($background);
		return $background;
        break;
 case  "notice" :
        $background= gd_filter_notice($background);
		return $background;
        break;
 case  "exquisite" :
        $background= gd_filter_exquisite($background);
		return $background;
        break;
									
								   case  "adpink" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
									   case  "adpurple" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								   case  "fun" :
								  $background= gd_filter_fun($background);
								  return $background;
								  break;
								   case  "bold" :
								  $background= gd_filter_bold($background);
								  return $background;
								  break;
								   case  "redx" :
								  $background= gd_filter_redX($background);
								  return $background;
								  break;
								   case  "sweetbox" :
								  $background= gd_filter_sweetbox($background);
								  return $background;
								  break;
								   case  "corporate" :
								  $background= gd_filter_corporate($background);
								  return $background;
								  break;
								   case  "corporateblack" :
								  $background= gd_filter_corporateblack($background);
								  return $background;
								  break;
								   case  "twisted" :
								  $background= gd_filter_twisted($background);
								  return $background;
								  break;
								   case  "whitebrand" :
								  $background= gd_filter_whitebrand($background);
								  return $background;
								  break;
								   case  "awesome" :
								  $background= gd_filter_awesome($background);
								  return $background;
								  break; 
									case  "awesome2" :
								  $background= gd_filter_awesome2($background);
								  return $background;
								  break; 
									case  "elated" :
								  $background= gd_filter_elated($background);
								  return $background;
								  break; 
									case  "newsupdate" :
								  $background= gd_filter_newsupdate($background);
								  return $background;
								  break; 
								   case  "professional" :
								  $background= gd_filter_professional($background);
								  return $background;
								  break; 
								   case  "clean" :
        $background= gd_filter_clean($background);
		return $background;
        break; 
		 case  "stylish" :						  
        $background= gd_filter_stylish($background);
		return $background;
        break; 
								  case  "tech" :
								  $background= gd_filter_tech($background);
								  return $background;
								  break;
								  case  "twitter" :
								  $background= gd_filter_twitter($background);
								  return $background;
								  break;
								  case  "awesometweet" :
								  $background= gd_filter_awesometweet($background);
								  return $background;
								  break;
								  case  "executive" :
								  $background= gd_filter_executive($background);
								  return $background;
								  break;
								  case  "business" :
								  $background= gd_filter_business($background);
								  return $background;
								  break;
								  case  "realnews" :
								  $background= gd_filter_realnews($background);
								  return $background;
								  break;
								  
								  case  "elegant" :
								  $background= gd_filter_elegant($background);
								  return $background;
								  break;
								  case  "brownblog" :
								  $background= gd_filter_brownblog($background);
								  return $background;
								  break;
									  case  "blogmain" :
								  $background= gd_filter_blogmain($background);
								  return $background;
								  break;
								  case  "purpleblog" :
								  $background= gd_filter_purpleblog($background);
								  return $background;
								  break;
								  
								  case  "redblog" :
								  $background= gd_filter_redblog($background);
								  return $background;
								  break;
								  case  "masters" :
								  $background= gd_filter_masters($background);
								  return $background;
								  break;
								  case  "blueblog" :
								  $background= gd_filter_blueblog($background);
								  return $background;
								  break;
								  case  "greenblog" :
								  $background= gd_filter_greenblog($background);
								  return $background;
								  break;
								  
								  case  "boldgreen" :
								  $background= gd_filter_boldgreen($background);
								  return $background;
								  break;
								  
								  case  "boldblue" :
								  $background= gd_filter_boldblue($background);
								  return $background;
								  break;
								  case  "boldorange" :
								  $background= gd_filter_boldorange($background);
								  return $background;
								  break;
								  case  "boldred" :
								  $background= gd_filter_boldred($background);
								  return $background;
								  break;
							   case  "powerful" :
								  $background= gd_filter_powerful($background);
								  return $background;
								  break;
									   case  "redglory" :
								  $background= gd_filter_redglory($background);
								  return $background;
								  break;
								  
								   case  "now" :
								  $background= gd_filter_now($background);
								  return $background;
								  break;
								   case  "rightnow" :
								  $background= gd_filter_rightnow($background);
								  return $background;
								  break;
								   case  "headlines" :
								  $background= gd_filter_headlines($background);
								  return $background;
								  break;
		 case  "worldnews" :
        $background= gd_filter_worldnews($background);
		return $background;
        break;

		 case  "reporting" :
        $background= gd_filter_reporting($background);
		return $background;
        break;
								  case  "boldpurple" :
								  $background= gd_filter_boldpurple($background);
								  return $background;
								  break;
								  
								  case  "boldblack" :
								  $background= gd_filter_boldblack($background);
								  return $background;
								  break;
								   
								  
								   case  "colored" :
								  $background= gd_filter_colored($background);
								  return $background;
								  break;
								   case  "stickynote" :
								  $background= gd_filter_stickynote($background);
								  return $background;
								  break;
								   case  "coffee" :
								  $background= gd_filter_coffee($background);
								  return $background;
								  break;
								   case  "highlight" :
								  $background= gd_filter_highlight($background);
								  return $background;
								  break;
								   case  "funky" :
								  $background= gd_filter_funky($background);
								  return $background;
								  break;
								   case  "coolblue" :
								  $background= gd_filter_coolblue($background);
								  return $background;
								  break;
								   case  "punch" :
								  $background= gd_filter_punch($background);
								  return $background;
								  break;
										case  "trends" :
								  $background= gd_filter_trends($background);
								  return $background;
								  break;
									case  "smart" :
								  $background= gd_filter_smart($background);
								  return $background;
								  break;
								   case  "nairobi" :
								  $background= gd_filter_nairobi($background);
								  return $background;
								  break;
								   case  "nairobi2" :
								  $background= gd_filter_nairobi2($background);
								  return $background;
								  break;
								  
									 case  "news" :
								  $background= gd_filter_news($background);
								  return $background;
								  break;
								  
								   case  "breaking" :
								  $background= gd_filter_breaking($background);
								  return $background;
								  break;
								   case  "newsy" :
								  $background= gd_filter_newsy($background);
								  return $background;
								  break;
								  
								  case  "happening" :
								  $background= gd_filter_happening($background);
								  return $background;
								  break;

								  case  "gaa" :
								  $background= gd_filter_gaa($background);
								  return $background;
								  break;
								  
								  case  "sevens" :
								  $background= gd_filter_sevens($background);
								  return $background;
								  break;
								  case  "live" :
								  $background= gd_filter_live($background);
								  return $background;
								  break;
								  case  "exclusive" :
								  $background= gd_filter_exclusive($background);
								  return $background;
								  break;
									case  "newsone" :
								  $background= gd_filter_newsone($background);
								  return $background;
								  break;   
								  case  "atnine" :
								  $background= gd_filter_atnine($background);
								  return $background;
								  case  "blank" :
								  $background= gd_filter_blank($background);
								  return $background;
								  break;
								  
							   
							  }
						}
						 	
						include("mags/default.php"); 	
						 
				
			}
			if (!empty($moodswing1))
			{
				
				$moodswing2 = $moodswing1;
					
				include("mags/effects.php");
				
			}			
			 

if (!empty($moodswing0))
{
 $startag =findStartag($moodswing0);
 $startag = explode('|',$startag);
 $picture = $startag[0];
$x = $startag[4];
$y = $startag[5];
$fx = $startag[6];
			
			if (!empty($picture))
		{
		  
				if (!empty($text) && !empty($picture))
				{
				$background = gd_apply_overlay2($background,  $picture , 100,$x,$y);				




						 
							 
						 






				if (!empty($_GET['fx']))
				{
					$moodswing2 = $_GET['fx'];
					
				include("mags/effects.php"); 
				}
				
				
				if (!empty($fx))
				{
					$moodswing2 = $startag[6];
					
				include("mags/effects.php"); 
				}
				
				
				
				if (!empty($moodswing1))
				{
				$moods =strtolower($moodswing1);
				
				include("mags/moods.php"); 
				}
				else
				{
				$themes = $startag[1];
				$moods =strtolower($themes);
				include("mags/moods.php"); 
				} 


				
				}
				if (empty($text) && !empty($picture))
				{
				$background = gd_apply_overlay2($background,  $picture , 100,$x,$y);
				$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
				$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color 
				$yanani = $startag[3];
				$yanani = "*".yanani($yanani); 
				imagettftext($background,35, 0, 20, 580, $font_color2, $fontZ, $yanani);
				}
		
		
		
		}
		else
		{
				if (!empty($text) && empty($picture))
				{
				
				$startag =openGallery($moodswing0);
			$startag =openGallery($moodswing0);
						if(!empty($startag))
						{
							$startag = explode('|',$startag);
							$picture = $startag[0];
							$background = gd_apply_overlay4($background, $picture, 100);
							$moods = $startag[1];
							if(!empty($moodswingX))
							{ 
							    $moodswing2 = $moodswingX;
								include("mags/effects.php");
							}
							

							
							if(!empty($moodswing1))
							{
								$moods =strtolower($moodswing1);
							}
							else
							{
								$moods = $startag[1];
								$moods =strtolower($moods); 
							}
   
							switch ($moods) {
								case  "widgetstats" :
								  $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetstats2" :
								   $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetstats" :
								   $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetblue" :
								   $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetred" :
								  $background= gd_filter_widget($background);
								  return $background;
								  break;
								   case  "widgetgreen" :
								   $background= gd_filter_widget($background);
								  return $background;
								  break;
									 case  "classic" :
								  $background= gd_filter_classic($background);
								  return $background;
								  break;
								  case  "royal" :
								  $background= gd_filter_royal($background);
								  return $background;
								  break;
								  case  "yellow" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
								  case  "coolpost" :
								  $background= gd_filter_coolpost($background);
								  return $background;
								  break;
								  case  "glassy" :
								  $background= gd_filter_glassy($background);
								  return $background;
								  break;
								  case  "followme" :
								  $background= gd_filter_followme($background);
								  return $background;
								  break;
								  case  "orange" :
								  $background= gd_filter_orange($background);
								  return $background;
								  break;
								  case  "green" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
									
								   case  "blue" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
								   case  "red" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
									   case  "purple" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
								  case  "modernyellow" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
								  case  "moderngreen" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									
								   case  "modernblue" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
								   case  "modernred" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									   case  "modernpurple" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									   case  "modernpink" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;

								  case  "modernyellow" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
								  case  "moderngreen" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									
								   case  "modernblue" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
								   case  "modernred" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									   case  "modernpurple" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;
									   case  "modernpink" :
								  $background= gd_filter_modern($background);
								  return $background;
								  break;



								  case  "shangwemtaani" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
								  case  "teammafisi" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
									
								   case  "thisisforyou" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
								   case  "mpesa" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
									   case  "suzziemaselfie" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;
									   case  "safaricomcare" :
								  $background= gd_filter_safaricom($background);
								  return $background;
								  break;




									   case  "pink" :
								  $background= gd_filter_yellow($background);
								  return $background;
								  break;
								   case  "calmgreen" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
								   case  "calmyellow" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
								   case  "calmblue" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
								   case  "calmred" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
									   case  "calmpurple" :
								  $background= gd_filter_calmgreen($background);
								  return $background;
								  break;
									   case  "adgreen" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								   case  "adyellow" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								  case  "adwhite" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								   case  "adblue" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
							   
						   case  "adred" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								  
							 case  "impact" :
									$background= gd_filter_impact($background);
									return $background;
									break;
 case  "notice" :
        $background= gd_filter_notice($background);
		return $background;
        break;
 case  "exquisite" :
        $background= gd_filter_exquisite($background);
		return $background;
        break;
									 case  "classy" :
        $background= gd_filter_classy($background);
		return $background;
        break;

								   case  "adpink" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
									   case  "adpurple" :
								  $background= gd_filter_adgreen($background);
								  return $background;
								  break;
								   case  "fun" :
								  $background= gd_filter_fun($background);
								  return $background;
								  break;
								   case  "bold" :
								  $background= gd_filter_bold($background);
								  return $background;
								  break;
								   case  "redx" :
								  $background= gd_filter_redX($background);
								  return $background;
								  break;
								   case  "sweetbox" :
								  $background= gd_filter_sweetbox($background);
								  return $background;
								  break;
								   case  "corporate" :
								  $background= gd_filter_corporate($background);
								  return $background;
								  break;
								   case  "corporateblack" :
								  $background= gd_filter_corporateblack($background);
								  return $background;
								  break;
								   case  "twisted" :
								  $background= gd_filter_twisted($background);
								  return $background;
								  break;
								   case  "whitebrand" :
								  $background= gd_filter_whitebrand($background);
								  return $background;
								  break;
								   case  "awesome" :
								  $background= gd_filter_awesome($background);
								  return $background;
								  break; 
									case  "awesome2" :
								  $background= gd_filter_awesome2($background);
								  return $background;
								  break; 
									case  "elated" :
								  $background= gd_filter_elated($background);
								  return $background;
								  break; 
									case  "newsupdate" :
								  $background= gd_filter_newsupdate($background);
								  return $background;
								  break; 
								   case  "professional" :
								  $background= gd_filter_professional($background);
								  return $background;
								  break; 
								   case  "clean" :
        $background= gd_filter_clean($background);
		return $background;
        break; 
		 case  "stylish" :
        $background= gd_filter_stylish($background);
		return $background;
        break; 
		
								  case  "tech" :
								  $background= gd_filter_tech($background);
								  return $background;
								  break;
								  case  "twitter" :
								  $background= gd_filter_twitter($background);
								  return $background;
								  break;
								  case  "awesometweet" :
								  $background= gd_filter_awesometweet($background);
								  return $background;
								  break;
								  case  "executive" :
								  $background= gd_filter_executive($background);
								  return $background;
								  break;
								  case  "business" :
								  $background= gd_filter_business($background);
								  return $background;
								  break;
								  case  "realnews" :
								  $background= gd_filter_realnews($background);
								  return $background;
								  break;
								  
								  case  "elegant" :
								  $background= gd_filter_elegant($background);
								  return $background;
								  break;
								  case  "brownblog" :
								  $background= gd_filter_brownblog($background);
								  return $background;
								  break;
									  case  "blogmain" :
								  $background= gd_filter_blogmain($background);
								  return $background;
								  break;
								  case  "purpleblog" :
								  $background= gd_filter_purpleblog($background);
								  return $background;
								  break;
								  
								  case  "redblog" :
								  $background= gd_filter_redblog($background);
								  return $background;
								  break;
								  case  "masters" :
								  $background= gd_filter_masters($background);
								  return $background;
								  break;
								  case  "blueblog" :
								  $background= gd_filter_blueblog($background);
								  return $background;
								  break;
								  case  "greenblog" :
								  $background= gd_filter_greenblog($background);
								  return $background;
								  break;
								  
								  case  "boldgreen" :
								  $background= gd_filter_boldgreen($background);
								  return $background;
								  break;
								  
								  case  "boldblue" :
								  $background= gd_filter_boldblue($background);
								  return $background;
								  break;
								  case  "boldorange" :
								  $background= gd_filter_boldorange($background);
								  return $background;
								  break;
								  case  "boldred" :
								  $background= gd_filter_boldred($background);
								  return $background;
								  break;
							   case  "powerful" :
								  $background= gd_filter_powerful($background);
								  return $background;
								  break;
									   case  "redglory" :
								  $background= gd_filter_redglory($background);
								  return $background;
								  break;
								  
								   case  "now" :
								  $background= gd_filter_now($background);
								  return $background;
								  break;
								   case  "rightnow" :
								  $background= gd_filter_rightnow($background);
								  return $background;
								  break;
								   case  "headlines" :
								  $background= gd_filter_headlines($background);
								  return $background;
								  break;
		 case  "worldnews" :
        $background= gd_filter_worldnews($background);
		return $background;
        break;
		 case  "reporting" :
        $background= gd_filter_reporting($background);
		return $background;
        break;
								  case  "boldpurple" :
								  $background= gd_filter_boldpurple($background);
								  return $background;
								  break;
								  
								  case  "boldblack" :
								  $background= gd_filter_boldblack($background);
								  return $background;
								  break;
								   
								  
								   case  "colored" :
								  $background= gd_filter_colored($background);
								  return $background;
								  break;
								   case  "stickynote" :
								  $background= gd_filter_stickynote($background);
								  return $background;
								  break;
								   case  "coffee" :
								  $background= gd_filter_coffee($background);
								  return $background;
								  break;
								   case  "highlight" :
								  $background= gd_filter_highlight($background);
								  return $background;
								  break;
								   case  "funky" :
								  $background= gd_filter_funky($background);
								  return $background;
								  break;
								   case  "coolblue" :
								  $background= gd_filter_coolblue($background);
								  return $background;
								  break;
								   case  "punch" :
								  $background= gd_filter_punch($background);
								  return $background;
								  break;
										case  "trends" :
								  $background= gd_filter_trends($background);
								  return $background;
								  break;
									case  "smart" :
								  $background= gd_filter_smart($background);
								  return $background;
								  break;
								   case  "nairobi" :
								  $background= gd_filter_nairobi($background);
								  return $background;
								  break;
								   case  "nairobi2" :
								  $background= gd_filter_nairobi2($background);
								  return $background;
								  break;
								  
									 case  "news" :
								  $background= gd_filter_news($background);
								  return $background;
								  break;
								  
								   case  "breaking" :
								  $background= gd_filter_breaking($background);
								  return $background;
								  break;
								   case  "newsy" :
								  $background= gd_filter_newsy($background);
								  return $background;
								  break;
								  case  "happening" :
								  $background= gd_filter_happening($background);
								  return $background;
								  break;
								  case  "gaa" :
								  $background= gd_filter_gaa($background);
								  return $background;
								  break;case  "sevens" :
								  $background= gd_filter_sevens($background);
								  return $background;
								  break;
								  case  "live" :
								  $background= gd_filter_live($background);
								  return $background;
								  break;
								  case  "exclusive" :
								  $background= gd_filter_exclusive($background);
								  return $background;
								  break;
									case  "newsone" :
								  $background= gd_filter_newsone($background);
								  return $background;
								  break;   
								  case  "atnine" :
								  $background= gd_filter_atnine($background);
								  return $background;
								  case  "blank" :
								  $background= gd_filter_blank($background);
								  return $background;
								  break;
								  
							   
							  }


	 
						}
			include("mags/default.php"); 	
		 
				
				}
			
		}
	
}	 
 
   

  
/*$background = gd_filter_news($background);*/
return $background; 
	
	
}
function gd_filter_news($background)
{ 
 
$background = gd_apply_overlay($background, 'news', 100);

$picme=profilepicture();
if(!empty($picme)) 
{
$x =8; $y=435; $w=50; $h=50; 
$background = gd_apply_logo($background, $picme, 100,$x,$y,$w,$h);
}

$background = gd_filter_contrast($background);
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Hv.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
$font_color = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  72,73,77); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,100,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=10)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 






$font_size = 30;
$user2      = "Twitter: @".username(); 
$user3      = user(); 
$slug      = strtoupper("startag.co/".slug());

imagettftext($background,10, 0, 210, 485, $font_color3, $fontX, $user3." | ".$text); //Write 
 
$limit=6;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}
$text2 = removeslashes($text2); 
imagettftext($background,20, 0, 17, 515, $font_color, $fontZ, $text2); 
imagettftext($background,13, 0, 17, 534, $font_color2, $fontW, $user2); 
imagettftext($background,9, 0, 390, 558, $font_color3, $fontZ, $slug);   

 
return $background; 
	
	
}

function gd_filter_breaking($background)
{ 

$background = gd_apply_overlay($background, 'breaking', 100);
 $background = gd_filter_contrast($background);
$picme=profilepicture();
if(!empty($picme)) 
{
$x =493; $y=30; $w=78; $h=78; 
$background = gd_apply_logo($background, $picme, 20,$x,$y,$w,$h);
} 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontZ = 'assets/fonts/futureforcesexpandital.ttf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
$font_color = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  72,73,77); // Create blue color  

 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= strtoupper(trim($text)); 

$limit=5;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}



$lowerText = strtolower($text);
if (preg_match('/>video/',$lowerText)){} 
else
{
$text2 = removeslashes($text2);	
imagettftext($background,35, 0, 25, 507, $font_color, $fontX, $text2); //Write 
}

  

$font_size = 30;
$user2      = "*".username(); 
$user3      = user(); 
$slug      = strtoupper("startag.co/".slug());
 $date =date('H:i');
 $date2 =date('d/m/Y ');
 

imagettftext($background,13, 0, 17, 538, $font_color2, $fontW, $user2); 
imagettftext($background,13, 0, 17, 560, $font_color3, $fontW, $date); 
imagettftext($background,13, 0, 59, 560, $font_color, $fontW, $date2); 
imagettftext($background,10, 0, 135, 538, $font_color3, $fontX,  $text ); //Write     
imagettftext($background,10, 0, 235,  455, $font_color3, $fontX, $slug); //Write     

  
return $background; 
	
	
}function gd_filter_newsy($background)
{ 


 $background = gd_filter_contrast($background);
$picme=profilepicture();
if(!empty($picme)) 
{
$x =0; $y=538; $w=70; $h=70; 
$background = gd_apply_logo($background, $picme, 100,$x,$y,$w,$h);
} 
$background = gd_apply_overlay($background, 'newsy', 100);
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Bd.otf'; //font used
$fontZ = 'assets/fonts/futureforcesexpandital.ttf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$font_color = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  72,73,77); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
$text = stripslashes($text) ; 
$text = nl2br(htmlentities($text, ENT_QUOTES, 'UTF-8'));
$text = preg_replace('/\s+/', ' ', trim($text));
/*preg_match('/#([A-Za-z0-9\/\.]*)/',$text,$matches);
$mood ="*".$matches[1];
*/
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= strtoupper(trim($text)); 


$limit=5;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}


$text = wordwrap($text,1000,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.9*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=25)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text2 = removeslashes($text2); 
imagettftext($background,25, 0, 5, 528, $font_color3, $fontX, $text2); //Write 


$font_size = 30;
$user2      = strtoupper("*".username()); 
$user3      = strtoupper(user()); 
$slug      = strtoupper("startag.co/".slug());
 $date =date('H:i A');
 $date2 =date('d/m/Y ');
 
 
imagettftext($background,10, 0, 180, 590, $font_color2, $fontX, $user3."   ".$user2."   ".$slug); 
imagettftext($background,12, 0, 75, 589, $font_color3, $fontX, $date); 
$text = removeslashes($text); 
imagettftext($background,10, 0, 75, 560, $font_color3, $fontX,  $text ); //Write     
  

  
return $background; 
	
	
}
function gd_filter_atnine($background)
{ 
 
 if ($_GET['overlay']!="no") { $background = gd_apply_overlay($background, 'atnine', 100);}  
 
 
$picme=profilepicture();
if(!empty($picme)) 
{
$x =20; $y=20; $w=50; $h=50; 
$background = gd_apply_logo($background, $picme, 70,$x,$y,$w,$h);
}

 $background = gd_filter_contrast($background);
 
$fontY = 'assets/fonts/BebasNeue.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontZ = 'assets/fonts/futureforcesital.ttf'; //font used
$fontW = 'assets/fonts/EHSMB.TTF'; //font used
$font_color5 = imagecolorallocate($background,   249,215,151); // Create blue color 
$font_color4 = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color = imagecolorallocate($background,   55,61,70); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  72,73,77); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= strtoupper(trim($text)); 
 
 
$font_size = 1;
$txt_max_width = intval(0.9*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=35)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
 
 
 
 
 
 
 
$limit=5;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}
 
 
 $text2 = removeslashes($text2);
imagettftext($background,25, 0, 5,539, $font_color4, $fontY, $text2); //Write 
/*imagettftext($background,25, 0, 10,539, $font_color4, $fontY, $text); //Write */




$font_size = 30;
$user2      = "*".strtoupper(username()); 
$user3      = strtoupper(user()); 
$slug      = strtoupper("startag.co/".slug());
 
 
 
 
 
 
 $text = wordwrap($text,57,"\n");
 $text=ucwords($text);
 
 $font_size = 1;
$txt_max_width = intval(0.99*450);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=10)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 8;
 
 
 

$text = removeslashes($text);
imagettftext($background,$font_size, 0, 5, 570, $font_color5, $fontX,$text); 

 $myArray = get_spaces($user3, $str = 0);
$user3 =$myArray[0];


$dimensions = imagettfbbox(30, 0, $fontZ,$user3 );
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-10; 
imagettftext($background,30, 0, $x2, 500, $font_color3, $fontZ,$user3 ); //Write     

$dimensions = imagettfbbox(10, 0, $fontX, $user2);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-105; 
imagettftext($background,10, 0,$x2, 520, $font_color2, $fontX, $user2); 

 
$dimensions = imagettfbbox(20, 0, $fontY,$slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,20, 0, $x2, 40, $font_color5, $fontY,$slug); //Write   
 




 $date =date('H:i');
 $date2 =date('d/m/Y ');
 
 
imagettftext($background,10, 0, 540, 528, $font_color3, $fontW, $date);










return $background; 
	
	
}

function gd_filter_blank($background)
{  
return $background; 
	
	
}
function gd_filter_newsone($background)
{ 
 
$background = gd_apply_overlay($background, 'newsone', 100);
 $background = gd_filter_contrast($background);
 
$fontY = 'assets/fonts/MyriadPro-Semibold.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Hv.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
$font_color = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  72,73,77); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= strtoupper(trim($text)); 
$text = wordwrap($text,1000,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.9*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=35)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
imagettftext($background,25, 0, 35,522, $font_color3, $fontX, $text); //Write 





$font_size = 30;
$user2      = "Twitter: @".username(); 
$user3      = user(); 
$slug      = strtoupper("startag.co/".slug());
 
 
imagettftext($background,13, 0, 15,   470, $font_color, $fontZ, $user3); 
imagettftext($background,13, 0, 17, 470, $font_color2, $fontW, $user2); 
imagettftext($background,10, 0, 240, 470, $font_color3, $fontX, $slug); //Write     

 
return $background; 
	
	
}

function gd_filter_happening($background)
{ 
 
$background = gd_apply_overlay($background, 'happening', 100);
 $background = gd_filter_contrast($background);
 
$fontY = 'assets/fonts/Exo2.0-SemiBold_0.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Hv.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
$font_color = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  72,73,77); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
/*preg_match('/#([A-Za-z0-9\/\.]*)/',$text,$matches);
$mood ="*".$matches[1];
*/



/*preg_match('/#([A-Za-z0-9\/\.]*)/',$text,$matches);
$mood ="*".$matches[1];
*/


$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= strtoupper(trim($text)); 

$limit=4;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}



$lowerText = strtolower($text);
if (preg_match('/>video/',$lowerText)){} 
else
{
$text2 = removeslashes($text2);	
imagettftext($background,35, 0, 25, 507, $font_color, $fontY, $text2); //Write 
}

 
	
  
	
  
 


$font_size = 30;
$user2      = "*".username(); 
$user3      = strtoupper(user()); 
$slug      = strtoupper("startag.co/".slug());
 $date =date('H:i');
 $date2 =date('d/m/Y ');
 $user3      = $user3;
 $myArray = get_spaces($user3, $str = 0);
$firstname =$myArray[0];
$secondname ="".$myArray[1];


imagettftext($background,25, 0, 25, 449, $font_color3, $fontY, $firstname); 
imagettftext($background,13, 0, 17, 570, $font_color3, $fontW, $date); 
imagettftext($background,13, 0, 59, 570, $font_color, $fontW, $date2); 
/*imagettftext($background,12, 0, 160, 544, $font_color, $fontX,  $text );*/  

 $bio      =  strtoupper(bio())  ;
 
imagettftext($background,12, 0, 160, 544, $font_color, $fontX,  $bio ); //Write   

$dimensions = imagettfbbox(10, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-25; 
imagettftext($background,10, 0, $x2, 82, $font_color3, $fontY, $slug); 




   
 
return $background; 
	
	
}
function gd_filter_live($background)
{ 
 
$background = gd_apply_overlay($background, 'live', 100);
 $background = gd_filter_contrast($background);
 
$fontY = 'assets/fonts/Exo2.0-SemiBold_0.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Hv.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
$font_color = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  72,73,77); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/*([A-Za-z0-9\/\.]*)/',$text,$matches);
$mood ="*".$matches[1];



/*preg_match('/#([A-Za-z0-9\/\.]*)/',$text,$matches);
$mood ="*".$matches[1];
*/


$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= strtoupper(trim($text)); 


$limit=6;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}



 
$font_size = 1;
$txt_max_width = intval(0.9*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$text2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=20)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text2 = removeslashes($text2);
imagettftext($background,$font_size, 0, 5, 518, $font_color3, $fontY, $text2); //Write 





$font_size = 30;
$user2      = "*".username(); 
$user3      = strtoupper(user()); 
$slug      = strtoupper("startag.co/".slug());
 $date =date('H:i');
 $date2 =date('d/m/Y ');

imagettftext($background,13, 0, 5, 544, $font_color2, $fontW, $date); 
imagettftext($background,13, 0, 47, 544, $font_color, $fontW, $date2); 
imagettftext($background,12, 0, 5, 570, $font_color3, $fontX,  $text ); //Write   




$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-25; 
imagettftext($background,20, 0, $x2, 40, $font_color2, $fontY, $slug); 




   
 
return $background; 
	
	
}

function gd_filter_exclusive($background)
{ 
 
$background = gd_apply_overlay($background, 'exclusive', 100);
 $background = gd_filter_contrast($background);
 
$fontY = 'assets/fonts/Exo2.0-SemiBold_0.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Hv.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-BdCnO.otf'; //font used
$fontC = 'assets/fonts/MyriadPro-Bold.otf'; //font used
$font_color = imagecolorallocate($background,   0,0,0); // Create blue color 
$font_color3 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color2 = imagecolorallocate($background,  72,73,77); // Create blue color  
$font_color4 = imagecolorallocate($background,  142,239,251); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
 

/*preg_match('/#([A-Za-z0-9\/\.]*)/',$text,$matches);
$mood ="*".$matches[1];
*/


$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= strtoupper(trim($text)); 


$limit=7;
if(stripos($text," "))
{
$ex_str=explode(" ",$text);
if(count($ex_str)>$limit)
{
for($i=0;$i<$limit;$i++)
{
$str_s.=$ex_str[$i]." ";
}
$text2= $str_s."...";
}
else{
$text2= $text;
}
}else{
$text2= $text;
}



 
$font_size = 1;
$txt_max_width = intval(0.9*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$text2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=20)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text2 = removeslashes($text2);
imagettftext($background,$font_size, 0, 5, 518, $font_color3, $fontY, $text2); //Write 

$newText =str_replace("$text2","..",$text);
/*imagettftext($background,12, 0, 5, 546, $font_color3, $fontX,  $newText ); //Write   */




$font_size = 30;
$user2      = "*".username(); 
$user3      = strtoupper(user()); 
$slug      = strtoupper("*".slug());
 $date =date('H:i');
 $date2 =date('d/m/Y ');

 $country      = strtoupper(country()); 
   $date =date('H:i');
 $date2 =date('d/m/Y ');
 
 
imagettftext($background,9, 0, 23, 51, $font_color3, $fontC, $date); 
imagettftext($background,10, 0, 23, 31, $font_color, $fontC, $country); 
  





$dimensions = imagettfbbox(15, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-5; 
imagettftext($background,15, 0, $x2, 476, $font_color2, $fontY, $slug);
 $slug      = "startag.co/".slug();
 $slug      = strtoupper($slug); 
 $dimensions = imagettfbbox(10, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-20; 
imagettftext($background,10, 0, $x2, 570, $font_color3, $fontC, $slug);


 

   
 
return $background; 
	
	
}

function gd_filter_widget($background)
{ 
 

if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  }
preg_match('/\*(\\w+)/',$text,$matches);
 $mood =$matches[1];
 $mood =strtolower($mood);
  
 
 
 
 if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
 $moodswing2 =strtolower($moodswing2);
 
 
 if (!empty($_GET['cl']))  
  { 
  $mood = "*startags"; 
  } 
  else{
	 if (empty($moodswing2))
{
$background = gd_apply_overlay($background, 'white', 80);
}
else
{
	$background = gd_apply_overlay($background, 'black', 50);
	
	}
 
  }
 
 
 switch ($mood) {
     
         case  "widgetstats" :
		 $background = gd_apply_overlay($background, 'widgetstats', 100);
          break;
		  case  "widgetstats2" :
		 $background = gd_apply_overlay($background, 'widgetstats2', 100);
          break;
         case  "widgetgreen" :
		 $background = gd_apply_overlay($background, 'widgetgreen', 100);
          break;
		    case  "widgetred" :
		 $background = gd_apply_overlay($background, 'widgetred', 100);
          break;
		    case  "widgetblue" :
		 $background = gd_apply_overlay($background, 'widgetblue', 100);
          break;
		
 }
 
$fontY = 'assets/fonts/OpenSans-ExtraBold.ttf'; //font used
$fontX = 'assets/fonts/OpenSans-CondBold_0.ttf'; //font used
$fontZ = 'assets/fonts/OpenSans-CondLight.ttf'; //font used
$fontW = 'assets/fonts/OpenSans-CondLight.ttf'; //font used
$font_color = imagecolorallocate($background,   255, 255, 255); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  255, 255,255); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,42,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=22)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, $x, $y, $font_color3, $fontX, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = "*".username(); 
$user3      = user(); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=25)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,$font_size, 0, 35, 50, $font_color2, $fontY, $user3); //Write 
imagettftext($background,$font_size-2, 0, 30, 80, $font_color2, $fontZ, $user2); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-50; 
imagettftext($background,20, 0, $x2, 570, $font_color2, $fontY, $slug); 
   

 
return $background; 
	
	
}



function gd_filter_professional($background)
{ 
 
$background = gd_apply_overlay($background, 'professional', 100);
 
 
$fontY = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-LtCnO.otf'; //font used
$fontW = 'assets/fonts/HelveticaLTStd-BlkCondObl.otf'; //font used
$font_color = imagecolorallocate($background,   255,223,67); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,26,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.9*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=22)) ;
$y = (600 - $txt_height) / 2;
$x = (300 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 35, $y, $font_color2, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtolower("*".username()); 
$user3      = strtoupper(user()); 
$slug      = "startag.co/".slug();
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=20)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,20, 0, 28, 585, $font_color3, $fontW, $user2); //Write 
imagettftext($background,$font_size, 0, 32, 100, $font_color, $fontY, $user3); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/

   
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-10; 
imagettftext($background,20, 0, $x2, 585, $font_color2, $fontY, $slug); 
 
return $background; 
	
	
}



function gd_filter_clean($background)
{


  if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 

$myArray = get_startags($text, $str = 0);
$moodswing2 =$myArray[1];
$moodswing2 =strtolower($moodswing2);

$hasPicture = verifyStartag();

if (empty($moodswing2))
{
	
if (empty($_GET['cl']) && empty($hasPicture)) { $background = gd_apply_overlay($background, 'clean', 98);}
if (!empty($hasPicture)) { $background = gd_apply_overlay($background, 'clean', 100);}
if (!empty($_GET['cl'])) { $background = gd_apply_overlay($background, 'clean', 100);}
}
else
{
	imagefilter($background, IMG_FILTER_BRIGHTNESS, 80);
	imagefilter($background, IMG_FILTER_CONTRAST, -20);
	imagefilter($background, IMG_FILTER_GRAYSCALE);
	$background = gd_apply_overlay($background, 'clean', 98);

}
 


		$font_color = imagecolorallocate($background,   62,62,64); // Create blue color

 
$fontY = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$fontW = 'assets/fonts/HelveticaLTStd-BlkCondObl.otf'; //font used

$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color  
	 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,26,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.8*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=35)) ;
$y = (600 - $txt_height) / 2;
$x = (300 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 75, $y, $font_color, $fontZ, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtolower("*".username()); 
$user3      = ucwords(strtolower(user())); 
$slug      = "startag.co/".slug();
 
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=20)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,20, 0, 92, 482, $font_color3, $fontZ, $slug); //Write 
imagettftext($background,$font_size, 0, 75, 100, $font_color, $fontZ, $user3); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/

/*   
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-10; 
imagettftext($background,20, 0, $x2, 585, $font_color2, $fontY, $slug); */
 
return $background; 
	
	
}

function gd_filter_stylish($background)
{
$background = gd_apply_overlay($background, 'stylish', 100);
 $background = gd_filter_contrast($background);
$picme=profilepicture();
if(!empty($picme)) 
{
$x =26; $y=304; $w=105; $h=105; 
$background = gd_apply_logo($background, $picme, 100,$x,$y,$w,$h);
} 
$fontY = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-BdCn.otf'; //font used
$fontZ = 'assets/fonts/futureforcesexpandital.ttf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-HvCn.otf'; //font used
$font_color = imagecolorallocate($background,   142,145,140); // Create blue color 
$font_color3 = imagecolorallocate($background,    100,100,100); // Create blue color  
$font_color2 = imagecolorallocate($background,  0,0,0); // Create blue color  
 
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,30,"\n");
 
$font_size = 1;
$txt_max_width = intval(1*300);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontX,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=14)) ;
$y = (340 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
$text = removeslashes($text); 
imagettftext($background,$font_size, 0, 305, 444, $font_color3, $fontY, $text); //Write   
  
  
  


$font_size = 30;
$user2      = "*".username(); 
$user3      = strtoupper(user()); 
$user3 = explode(" ", $user3);
$user3 = $user3[0];

$slug      = strtoupper("startag.co/".slug());
 $date =date('H:i');
 $date2 =date('d/m/Y ');
 

imagettftext($background,13, 0, 315, 305, $font_color2, $fontW, $user2); 

imagettftext($background,25, 0, 500, 360, $font_color, $fontW, $date); 
imagettftext($background,25, 0, 315, 267, $font_color2, $fontW, $user3);   
/*imagettftext($background,10, 0, 20,  570, $font_color3, $fontY, $slug);*/ //Write     
 
return $background; 
	
	
}
function gd_filter_newsupdate($background)
{ 
 
$background = gd_apply_overlay($background, 'newsupdate', 100);
 
 
$fontY = 'assets/fonts/HelveticaNeueLTStd-BlkCn.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$font_color = imagecolorallocate($background,   89,89,89); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,48,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=17)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 40, 420, $font_color2, $fontW, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = strtoupper(user()); 
$slug      =  "startag.co/".slug() ;
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=15)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,$font_size, 0, 28, 585, $font_color3, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 28, 375, $font_color3, $fontY, $user3); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
 
/*imagettftext($background,18, 0, 20, 570, $font_color2, $fontY, $slug); */
   
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,20, 0, $x2, 585, $font_color2, $fontY, $slug); 
 
return $background; 
	
	
}

function gd_filter_newsuszxzxpdate($background)
{ 
 
$background = gd_apply_overlay($background, 'newsupdate', 100);
 
 
$fontY = 'assets/fonts/HelveticaNeueLTStd-BlkCn.otf'; //font used
$fontX = 'assets/fonts/HelveticaNeueLTStd-Ex.otf'; //font used
$fontZ = 'assets/fonts/HelveticaNeueLTStd-UltLt.otf'; //font used
$fontW = 'assets/fonts/HelveticaNeueLTStd-Th.otf'; //font used
$font_color = imagecolorallocate($background,   89,89,89); // Create blue color 
$font_color2 = imagecolorallocate($background,   255, 255, 255); // Create blue color  
$font_color3 = imagecolorallocate($background,  0, 0,0); // Create blue color  
if (empty($_GET['cl']))  
  { 
  $text = realText() ; 
  } 
  else 
  { 
  $text = dummyText(); 
  } 
preg_match('/\*(\\w+)/',$text,$matches);
$mood ="*".$matches[1];
$text= preg_replace('/\*(\\w+)/', "", $text); 
$text= preg_replace('/\#(\\w+)/', "", $text);
$text= trim($text); 
$text = wordwrap($text,49,"\n");
 
$font_size = 1;
$txt_max_width = intval(0.85*600);

do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontZ,$text);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width)  &&   ($font_size   <=17)) ;
$y = (600 - $txt_height) / 2;
$x = (600 - $txt_width) / 2;
 
$text = removeslashes($text);
imagettftext($background,$font_size, 0, 40, 420, $font_color2, $fontW, $text); //Write 






$font_size = 1;
$txt_max_width = intval(0.7*250);
$user2      = strtoupper("*".username()); 
$user3      = strtoupper(user()); 
$slug      =  "startag.co/".slug() ;
do{
	$font_size++;
	$p = imagettfbbox($font_size,0,$fontY,$user2);
	$txt_width = $p[2] - $p[0];
	$txt_height = $p[1] - $p[7];
	
}
while (($txt_width <= $txt_max_width) &&   ($font_size   <=15)) ;
$y = (250 - $txt_height) / 2;
$x = (250 - $txt_width) / 2;

imagettftext($background,$font_size, 0, 28, 585, $font_color3, $fontY, $user2); //Write 
imagettftext($background,$font_size, 0, 28, 375, $font_color3, $fontY, $user3); //Write 

/*imagettfstroketext($background, 70, 0, 10, 50, $font_color2, $stroke_color, $fontZ, $user3, 2);*/
 
/*imagettftext($background,18, 0, 20, 570, $font_color2, $fontY, $slug); */
   
$dimensions = imagettfbbox(20, 0, $fontY, $slug);
$textWidth = abs($dimensions[4] - $dimensions[0]);
$x2 = 600 - $textWidth-30; 
imagettftext($background,20, 0, $x2, 585, $font_color2, $fontY, $slug); 
 
return $background; 
	
	
}