Text to Pic

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Damonc

Damon
Thread Starter
Joined
May 9, 2001
Messages
662
Hi,
I asked something along these lines a while ago - but I think I complicated it a little, and never really got an answer..

what I want to know is how is this kind of thing done?

Link
 

Damonc

Damon
Thread Starter
Joined
May 9, 2001
Messages
662
the question was, how does the taking text from an image and embedding it into an image work...

Yes my other topic in regards to access that you've linked to there is related.. heres what I'm wanting to do:

I work in a retail computer store, we used to have a website that was made specifically for us to generate signs for the store - ie price & spec sheets for laptops - which are saved as jpgs and set as the demo computers wallpaper.
The signs were created by the user filling out the various fields in a form (php) which were then embedded into the image for us to save.

Problem is the website that we were using has gone belly up, and the person that created it is no longer contactable, so I've half stuck my hand up/been asked to see what I can come up with. The system would need to be centralised so it can be accessed from several locations.. the access database that I started on is linked back to a MySQL database on a server..
 

Noyb

Jay
Trusted Advisor
Spam Fighter
Joined
May 25, 2005
Messages
21,134
That was a little over my head .. (I didn't have to Duck too far)
Sounds like a job for Photoshop .. Inserting Text/Images on top of a background.
Extracting text from an Image isn't easy .. unless it can be OCRed
 

Damonc

Damon
Thread Starter
Joined
May 9, 2001
Messages
662
Im not wanting to extract it from an image, Im wanting to insert it..

While we could use photoshop to type in the text to make each sign, its not ideal because a) its slow to do b) the data isnt being kept in a central location.
 

Damonc

Damon
Thread Starter
Joined
May 9, 2001
Messages
662
nope - the data isnt accessible from a central location - yes there is a vpn going between all the stores, but its shared folders are only for "privileged" access lol
 
Joined
Aug 12, 2007
Messages
696
Since you are using php, there are 2 ways to do this.

1. Server side with a php script using the ImageMagick package. I've used this script, which I call button.php, for a few years to generate buttons on the fly (forgot where I go this script, apologies to the creator):
PHP:
<?php
   Header("Content-type: image/gif");
   $text = $_GET['text'];
   $font = "arial.ttf";
   $s=11;
   if(!isset($s)) $s=11;
   $size = imagettfbbox($s,0,$font,$text);
   $dx = abs($size[2]-$size[0]);
   $dy = abs($size[5]-$size[3]);
   $xpad=10;
   $ypad=10;
   $im = imagecreate($dx+$xpad,$dy+$ypad);
   $blue = ImageColorAllocate($im, 0xe6,0xe7,0xbf);
   $black = ImageColorAllocate($im, 0,0,0);
   $white = ImageColorAllocate($im, 255,255,255);
   ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
   ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white);
   ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $black, $font, $text);
   ImageGif($im);
   ImageDestroy($im);
?>
You have to tell the script where to find your font file (here, arial.ttf is in the same directory as my button.php script. You also have to have the ImageMagick package installed on your server.
This is called from html script using something like:
Code:
<img src="/images/button.php?text=Save updated info">
2. Client side using css and javascript. I use jquery ui button widget (http://jqueryui.com/demos/button/). *Extremely* simple to use, easily customizable, cross-browser compatible, but depends on client-side javascript.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Members online

Top