...

View Full Version : Move Text Using php



digi duck
08-30-2006, 12:11 PM
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.


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

Thanks a lot. Digi

Fumigator
08-30-2006, 03:46 PM
Instead of the hard-coded coordinates for the text like you have, allow user input there.

digi duck
08-30-2006, 07:56 PM
how could i do that?

Fumigator
08-30-2006, 08:35 PM
Add options to the form (such as left, right, center, etc) and pass those options to your PHP script just like the other options are being passed to the script.

digi duck
09-04-2006, 10:44 AM
sorry to ask but could you please explain in more detail. where are the hard co ordinates

rafiki
09-05-2006, 09:49 AM
seems that the website isnt working

googleit
09-05-2006, 05:11 PM
yeah it says it cannot be found maybe this is just my comp?

rafiki
09-05-2006, 05:26 PM
it loading now, but not making sigs

digi duck
09-06-2006, 11:29 AM
ye sorry about that i was messing around thrying to make it so that the image would create on a html page but i kept getting errors and forgot to change it back to the working script as i was so fustrated. It kept coming up with hundreds of random letters where the pic. should be. This is because it was reading it as html/text not jpeg. Whenever i put in the
header("Content-type: image/jpeg"); so it reads it as jpeg it says headers already sent. No idea how to resolve this.

Anyway ill return the script to it's working form.

Thanks



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum