Jump to content

Move text in signature generator.


digi duck

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.


[code]<?
$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';
break;
case '2':
$bgpic = 'images/sig_maker/2.jpeg';
[color=red]carries on for ages[/color]
break;
}
$im = imagecreatefromjpeg($bgpic);
//Calculate, the centre:
for(;;){
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){
break;
}
$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);
if($_GET['dl']){
header('Content-Disposition: attachment; filename="sig.jpeg"');
}
header("Content-type: image/jpeg");
imagegif($im);
?>[/code]

PLEASE HELP.
Link to comment
https://forums.phpfreaks.com/topic/19652-move-text-in-signature-generator/
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.
  • 2 weeks later...
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);
[/code]

//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)


Archived

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

×
×
  • Create New...

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.