Jump to content

Superimposing values from mysql table onto images


davidcriniti

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()

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

Archived

This topic is now archived and is closed to further replies.

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