benyates1 Posted June 5, 2012 Share Posted June 5, 2012 Hi, I'm creating a badge generator. The purpose of the generator is to display, share, send and save custom badges. I have a selection of images to be used as the base or template image, each have two areas for differently formatted text, typically 1) being the title/award and 2) being a brief two-line summary of the achievement. The user would select an image template and enter text into text fields and then select a text colour. Once save button is clicked an image is generated with the text as part of the graphic. The user should be able to save the graphic to their hard drive, embed the graphic to their own web site, share it via social media sites. The created images should also be attributed to the user so that the site can keep a list of all users badges and accolades that they have created, attributed to themselves or other users. I'm really stuck and so far have made a pitiful attempt at realising this script. Below is what I have so far but have no idea how to tie in the features I have listed above. <?php header ("Content-type: image/png"); $string = "your text"; // try changing this as well $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefrompng("new.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); ?> Any help would be greatly appreciated. Kind Regards, Ben Quote Link to comment https://forums.phpfreaks.com/topic/263701-badge-generator/ 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.