I wrote one too (once upon a time) whilst learning about GD, but I was just reading off *DATA
#!C:/perl/bin/perl #!/usr/bin/perl BEGIN { unless( -t STDIN){ # if run on commandline, none of this require CGI::Carp; CGI::Carp::carpout(\*LOGGY) if open(LOGGY,'>>'.__FILE__.'.err.log'); CGI::Carp->import( 'fatalsToBrowser' ); } } use strict; use warnings; use GD; use constant PI => 3.141519; # close enough use GD::Text::Wrap; use GD::Text::Align; my $quote = [ grep { $_ } map { chomp; $_ } <DATA> ]; $quote = $$quote[rand @$quote]; my $author = substr $quote, rindex($quote,'--'), length($quote) -rindex($quote, '--'), ''; #my $gd = GD::Image->new(800,600); my $gd = GD::Image->new(800,600); $gd->colorAllocate(255, 255, 255); my $black = $gd->colorAllocate(0, 0, 0); my $red = $gd->colorAllocate(255, 0, 0); my $blue = $gd->colorAllocate(0, 0, 255); #$gd->transparent($red); $gd->interlaced('true'); $quote = GD::Text::Wrap->new( $gd, width => 800, # has no effect (a bug) line_space => 4, color => $black, text => $quote, preserve_nl => 1, ); $quote->set_font(gdLargeFont); $quote->set(align => 'center', width => 12 * 30); $quote->draw(10,10); $author = GD::Text::Align->new($gd, valign => 'base', halign => 'right', text => $author, ); $author->set_font(gdLargeFont); # STUPID API, always have to pass x,y, otherwise its undef my($left, $top, $right, $bottom) = $quote->get_bounds(10,10); $author->draw( $right , $bottom + 20, PI, $blue); $gd->rectangle( $left -10, $top -10, $right +10, $bottom + 35 , $red); # resize the image (even if it don't affect file-size much for png's) my $gd2 = GD::Image->new( $right + 12, $bottom + 37 ); #$image->copy(sourceImage,dstX,dstY,srcX,srcY,width,height) object $gd2->copy( $gd, 0,0,0,0, $right + 12, $bottom + 37 ); print qq{Expires: Thu, 01 Jan 1970 00:00:00 GMT Date: Fri, 02 Jan 1970 00:00:00 GMT Content-Type: Image/Png\r\n\r\n}; binmode(STDOUT); print $gd2->png(); __END__ A good way to threaten somebody is to light a stick of dynamite. Then + you call the guy and hold the burning fuse up to the phone. "Hear th +at?" you say. "That's dynamite, baby." -- Deep Thoughts by Jack Hande +y (SNL) Who ate my stick of butter?! -- butterman Once while walking through the mall a guy came up to me and said "Hey +, how's it going?". So I grabbed his arm and twisted it up behind his + head and said "Now whose asking the questions?" -- Deep Thoughts by +Jack Handey (SNL) The memories of my family outings are still a source of strength to me +. I remember we'd all pile into the car - I forget what kind it was - + and drive and drive. I'm not sure where we'd go, but I think there w +ere some trees there. The smell of something was strong in the air as + we played whatever sport we played. I remember a bigger, older guy w +e called "Dad." We'd eat some stuff, or not, and then I think we went + home. I guess some things never leave you. -- Deep Thoughts by Jack +Handey (SNL) Marta says the interesting thing about fly-fishing is that it's two l +ives connected by a thin strand. Come on, Marta. Grow up. -- Deep Tho +ughts by Jack Handey (SNL)

____________________________________________________
** The Third rule of perl club is a statement of fact: pod is sexy.


In reply to Re: A new type of quote script by PodMaster
in thread A new type of quote script by mousey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.