Jump to content

Badge Generator


benyates1

Recommended Posts

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.