jnerotrix Posted October 25, 2008 Share Posted October 25, 2008 Ok I am Making an ID Card For A Game and I want users to Type in Their account name and it places the text on the card Here is what i need it to do i made this form basically showing what its going to do and what it willl look like after generated is at the bottom http://custom-art.110mb.com/idcard/ Im just not sure how to do this Thanks, Jnero Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/ Share on other sites More sharing options...
.josh Posted October 25, 2008 Share Posted October 25, 2008 google captcha tutorials it's the same principle Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674308 Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 ok does this code look somewhat correct <?php $user = $_POST['user']; $text = $_POST['text']; $id = imagecreatefrompng("./default.png"); $string = "$user" $string2 = "$text" imagestring($id, 5, 20, 10, $string); imagestring($id, 5, 20, 10, $string2); header("Content-type: image/png"); imagepng($id); ?> Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674313 Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 ok edited the code a bit Hows This: <?php $user = $_POST['user']; $text = $_POST['text']; $img = $_POST['picture']; $id = imagecreatefrompng("./$img"); $string = "$user" $string2 = "$text" imagestring($id, 5, 20, 10, $string); imagestring($id, 5, 20, 10, $string2); header("Content-type: image/png"); imagepng($id); ?> Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674316 Share on other sites More sharing options...
PFMaBiSmAd Posted October 25, 2008 Share Posted October 25, 2008 ok does this code look somewhat correct Hows This: Simple, did it do what you wanted when you tested it? The point of programming is to write code to cause what you want or need to happen. After you write code, you test it. So, during the testing that you did to verify that the code does what you intended, did it? Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674322 Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 Ok I changed The Code a bit But I Get an error here is a new code <?php $user = $_POST['user']; $img = $_POST['picture']; $id = imagecreatefrompng("./$img"); $string = $user imagestring($id, 5, 20, 10, $string); <== This is Line 11 header("Content-type: image/png"); imagepng($id); ?> This is The error: Parse error: syntax error, unexpected T_STRING in /www/110mb.com/c/u/s/t/o/m/-/a/custom-art/htdocs/idcard/generatred.php on line 11 Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674329 Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 I keep trying to figure this out but i cant Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674338 Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 anobody understand the problem? Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674351 Share on other sites More sharing options...
dropfaith Posted October 25, 2008 Share Posted October 25, 2008 <?php $user = $_POST['user']; $img = $_POST['picture']; $id = imagecreatefrompng("./$img"); $string = $user; imagestring($id, 5, 20, 10, $string); <== This is Line 11 header("Content-type: image/png"); imagepng($id); ?> $string = $user; wasnt closed with a ; try my code above Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674370 Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 Ok I Rebuilt The Code But The Error Just Says The image “http://custom-art.110mb.com/idcard/generatred.php” cannot be displayed, because it contains errors. This is the new Code <?php header ("Content-type: image/png"); $string = "TEXT"; $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefrompng("./default.png"); $x = imagesx($im) - $width ; $y = imagesy($im) - $height; $backgroundColor = imagecolorallocate ($im, 255, 255, 255); $textColor = imagecolorallocate ($im, 0, 0,0); $a = imagechar($im, 1, 0, 0); imagestring ($im, $font, $x, $y, $a, $string, $textColor); imagepng($im); ?> Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674379 Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 Ok I got it fixed --- BUT the text just appears on the bottom right how do i place it in a specific spot Heres the fixed code <?php header ("Content-type: image/png"); $string = "TEXT"; $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefrompng("./default.png"); $x = imagesx($im) - $width ; $y = imagesy($im) - $height; $backgroundColor = imagecolorallocate ($im, 255, 255, 255); $textColor = imagecolorallocate ($im, 0, 0, 0); imagestring ($im, $font, $x, $y, $string, $textColor); imagepng($im); ?> Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674385 Share on other sites More sharing options...
jnerotrix Posted October 25, 2008 Author Share Posted October 25, 2008 How Do i Make The text Appear On The Image Where I Want it? Quote Link to comment https://forums.phpfreaks.com/topic/130057-solved-need-help-with-image-generator/#findComment-674528 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.