Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2023-02-02 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (24 votes). Check out past polls.

    Notices?