Jump to content


This topic is now archived and is closed to further replies.

digi duck

Move text in signature generator.

Recommended Posts

Hi everyone, i have a signature generator site called http://gamesigs.co.uk and have been trying to come up with a way let users move the text around so it doesn't just have to be in the middle. If you have any suggestions please help me as i'm a php novice. Here is the source that i think needs altering.

$name = stripslashes($_GET['name']);
$size = stripslashes($_GET['size']);
$font = 'images/sig_maker/fonts/'.stripslashes($_GET['font']).'.ttf';
$fontcolor['r'] = stripslashes($_GET['color_r']); // font color - RED
$fontcolor['g'] = stripslashes($_GET['color_g']); // font color - GREEN
$fontcolor['b'] = stripslashes($_GET['color_b']); // font color - BLUE
$shadow = stripslashes($_GET['shadow']);
$lines = stripslashes($_GET['lines']);
function arrow($im, $x1, $y1, $x2, $y2, $alength, $awidth, $color){
switch ($_GET['color']) {
case '1':
$bgpic = 'images/sig_maker/1.jpeg';
case '2':
$bgpic = 'images/sig_maker/2.jpeg';
[color=red]carries on for ages[/color]
$im = imagecreatefromjpeg($bgpic);
//Calculate, the centre:
list($image_width, $image_height) = getimagesize($bgpic);
list($left_x, , $right_x) = imagettfbbox($size, 0, $font, $name);
$text_width = $right_x - $left_x;
if($image_width > $text_width+5){
$size = $size - .5;
if($size == 1){
die('Script not responding to decreasing font size, in other words: try using less letters.');
$padding = ($image_width - $text_width)/2;
$textcolor = imagecolorresolve($im, $fontcolor['r'], $fontcolor['g'], $fontcolor['b']);
$grey = imagecolorallocate($im, 128, 128, 128);
if($shadow == 'y'){
imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name);
if($lines == 'y'){
//imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name);
imagettftext($im, $size, 0, $padding, 75, $textcolor, $font, $name);
header('Content-Disposition: attachment; filename="sig.jpeg"');
header("Content-type: image/jpeg");


Share this post

Link to post
Share on other sites
To do this with PHP, I think would be tedious for the user. I'd personally suggest doing it with JavaScript, there's a cool script [url=http://www.walterzorn.com/dragdrop/dragdrop_e.htm]HERE[/url] that you could use to drag a layer around on top of an image, and on creation of the image, grab the coords of the text so you know where to generate it.

Share this post

Link to post
Share on other sites
that looks pretty cool but i cant see how to make the layers into one image after the user has positioned it or grab the coordinates as you say and enter them in the code. any ideas?

Share this post

Link to post
Share on other sites
ok i've managed to do it. If anyone's interested you change the

[code]//imagettftext($im, $size, 0, $padding+1, 77, $grey, $font, $name);

//imagettftext($im, $size, angle, horizontal, height, $grey, $font, $name);

if you still don't get it contact me. (info found on site http://gamesigs.co.uk)

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.