1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Text to Pic

Discussion in 'Web Design & Development' started by Damonc, Jan 2, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. Damonc

    Damonc Thread Starter

    Joined:
    May 9, 2001
    Messages:
    655
    First Name:
    Damon
    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
     
  2. Noyb

    Noyb Trusted Advisor

    Joined:
    May 25, 2005
    Messages:
    20,917
    First Name:
    Jay
    Not sure I understand the question
     

    Attached Files:

  3. Noyb

    Noyb Trusted Advisor

    Joined:
    May 25, 2005
    Messages:
    20,917
    First Name:
    Jay
  4. Damonc

    Damonc Thread Starter

    Joined:
    May 9, 2001
    Messages:
    655
    First Name:
    Damon
    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..
     
  5. Noyb

    Noyb Trusted Advisor

    Joined:
    May 25, 2005
    Messages:
    20,917
    First Name:
    Jay
    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
     
  6. Damonc

    Damonc Thread Starter

    Joined:
    May 9, 2001
    Messages:
    655
    First Name:
    Damon
    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.
     
  7. Noyb

    Noyb Trusted Advisor

    Joined:
    May 25, 2005
    Messages:
    20,917
    First Name:
    Jay
    Not if you know how .. And have a master built.
    Is the data accessible from a central location ??
     
  8. Damonc

    Damonc Thread Starter

    Joined:
    May 9, 2001
    Messages:
    655
    First Name:
    Damon
    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
     
  9. ehymel

    ehymel

    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($im0xe6,0xe7,0xbf);
       
    $black ImageColorAllocate($im0,0,0);
       
    $white ImageColorAllocate($im255,255,255);
       
    ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
       
    ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white);
       
    ImageTTFText($im$s0, (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.
     
  10. Sponsor

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 733,556 other people just like you!

Loading...
Similar Threads - Text
  1. charlzguitarz
    Replies:
    4
    Views:
    460
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/972142

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice