Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Unix Operating Systems Software

Dynamic Text Graphics w/ Apache? 6

An Anonymous Internet Freak asks: "I have recently been made aware of a very useful feature in Roxen Webserver. It allows you to embed text into a html document, which the server coverts to a graphic containing that text. Eg. I want a button that says 'Home', so I include a command within the HRML code. As the page goes through the server, it dynamically creates an image containing that 'Home' at the defined size/colour etc. Can Apache do the same?" It shouldn't be too hard to do something like this in Perl with an early version of GD. Watch out for the licensing police, however! What do you all think? Is there a better solution?
This discussion has been archived. No new comments can be posted.

Dynamic Text Graphics w/ Apache?

Comments Filter:
  • by robin ( 1321 )
    The Website Meta Language [engelschall.com], which embeds (wait for it)
    • Pass 1: Source Reading and Include File Expansion (ipp)
    • Pass 2: Meta HTML Macro Construct Expansion (mhc)
    • Pass 3: Perl 5 Programming Construct Expansion (eperl)
    • Pass 4: M4 Macro Construct Expansion (gm4)
    • Pass 5: Diversion Filter (divert)
    • Pass 6: Character and String Substitution (asubst)
    • Pass 7: HTML Fixup (htmlfix)
    • Pass 8: Line Stripping and Output Fixup (htmlstrip)
    • Pass 9: Output Splitting and Final Writing (slice)
    might be what you're looking for -- specifically the gfont [engelschall.com] program that comes with the distrib.
    --
    W.A.S.T.E.
  • I have something like this working under PHP3, which runs as an Apache module. It caches the generated GIF so it does not have to regenerate it every time.

    It was not hard to put together, although it is not currently in a ready-to-distribute state.

    To stick graphic text in, I do something like this, using brackets instead of braces to slashdot doesn't nuke it:

    [img src="/text.php?text=Hello+World&size=15"]

    It's not as seamless as what Roxen does, but it works fine.

    As the question points out, it has to use an old GD that has GIF support.


  • I created a bunch of files, each with a different letter, with the GIMP and wrote this extremely small function:

    function pngtext($textstr) {
    $slen = strlen($textstr);
    for ( $i=0 ; $i<$slen ; $i++ ) {
    if(substr($textstr,$i,1) == " ") {
    printf("<img src=/images/sb-.png>");
    } else {
    printf("<img src=/images/sb-%s.png>",substr($textstr,$i,1));
    }
    }
    };


    (Wow, that would have been *much* easier if <pre> was allowed. I did that with nested <blockquote>s.)

    PHP3 also has functions for generating graphics on the fly. They are described at www.php.net [php.net].

    I've seen Perl scripts that generate graphics on the fly, so if you're more versed in that, try it out.
  • http://www.goof.com/pcg/marc/gimp.html [goof.com] I've done it, it works nicely.
    --
    http://www.wholepop.com/ [wholepop.com]
    Whole Pop Magazine Online - Pop Culture
  • The O'Reilley book on Java Servlets has sample code to do this. You can generate any graphic on the fly using Servlets -- not just fancy text.

    Java Servlets are also much more efficient than Perl CGI. You don't want to bog down your server for a cute little graphic effect!

Say "twenty-three-skiddoo" to logout.

Working...