Status
Not open for further replies.

r4myy

Active Member
155
2010
1
0
http://warezat.net/smileysign/make.php

wjunction.png
lol

Code kinda sucks but it works.. somewhat :X

PHP:
<?php
error_reporting(0);
header('Content-Type: image/png');
$_GET[id]=str_replace("%20","",$_GET[id]);
$_GET[id]=str_replace(".png","",$_GET[id]);

if(strlen($_GET[id])>17){ // :X:X:X:X
$imgPath = 'bannedlarge.png';
$l='Y';
}else{
$imgPath = 'banned.png';
}

// Atdod atpakal GD_ImageResource
function imageCreateFromJpegEx($file)
{
   $data = file_get_contents($file);
   $im = @imagecreatefromstring($data);
   $i = 0;
   while (!$im)
   {
       $data = substr_replace($data, "", -3, -2);
       $im = @imagecreatefromstring($data);
   }
   return $im;
}
   
$im = imageCreateFromJpegEx($imgPath);
$black = imagecolorallocate($im, 0, 0, 0);
$font = 'visitor2.ttf';
$text=explode('.png', $_GET[id], 2);
$text = wordwrap($text[0], 16, "\n", 1);

$bbox=imagettfbbox (10, 0, $font, $text);
$xcorr=0-$bbox[6];
$mase=$bbox[2]+$xcorr;
$width=imagesx($im);
$new=($width-$mase)/2;

$st=strlen($_GET[id]);
$mid=40-($st*2);

if($l=='Y'){
imagettftext($im, 10, 0, 3, 15, $black, $font, "$text");
}else{
imagettftext($im, 10, 0, $new, 25, $black, $font, "$text");
}
imagepng($im);
?>
Example of imagettftext

PHP:
  <?php
// Set the content-type
header('Content-type: image/png');

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
http://php.net/imagettftext if youre interested in this stuff
 
Status
Not open for further replies.
Back
Top