Jump to content

Recommended Posts

Hi,

 

I'm just after someone to point me in the right direction on this one, because I'm not sure how to go about it at all.

 

Let's say I've got a table called "tbl_badges" with data regarding badges that will be given to students based on their scores in a quiz.

 

Is it possible to pull the data from the 'badge_name' field and superimpose it on an image.

 

Ie: So badges would essentially look the same, but with different text on the same image.

 

The reason I'm after this solution is to enable non-tech saavy teachers to be able to create a badge by simply filling in a form which asks for a badge name.

 

To give you a visual on what I mean, see the image below.

 

roman_numerals_badge.png

 

While I've obviously created this myself, I'd like this to be created by "Roman Numerals Badge" being pulled from the badge_name field in the tbl_badges.

 

Anyway, just after some basic direction on what methods I need to investigate to achieve this.

 

Thanks,

 

Dave

 

 

Use plain badge as a background image

 

Process each line of text at a time

 

Use imagettfbbox() to calulate the width of the text so you can centre it

 

Output text at calculated position using imagettftext()

Edited by Barand

Thanks Barand.

 

Just to clarify, when you say "Process each line of text at a time" do you mean that my form for the teachers to submit their badge names (and consequently the table tbl_badges) should have a few fields?

...: (badge_line_1 , badge_line_2, badge_line_3 for example ?

 

Cheers,

 

Dave

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.