digi duck Posted September 4, 2006 Share Posted September 4, 2006 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 More sharing options...
zq29 Posted September 4, 2006 Share Posted September 4, 2006 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. Link to comment https://forums.phpfreaks.com/topic/19652-move-text-in-signature-generator/#findComment-85645 Share on other sites More sharing options...
digi duck Posted September 4, 2006 Author Share Posted September 4, 2006 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? Link to comment https://forums.phpfreaks.com/topic/19652-move-text-in-signature-generator/#findComment-85747 Share on other sites More sharing options...
digi duck Posted September 5, 2006 Author Share Posted September 5, 2006 *BUMP* Link to comment https://forums.phpfreaks.com/topic/19652-move-text-in-signature-generator/#findComment-86245 Share on other sites More sharing options...
digi duck Posted September 16, 2006 Author Share Posted September 16, 2006 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) Link to comment https://forums.phpfreaks.com/topic/19652-move-text-in-signature-generator/#findComment-92920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.