Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w use strict; use warnings; use CGI; use GD; my $query = new CGI; print $query->header; print $query->start_html("EasyPX Generator"); print "<H1>EasyPX Generator</H1>\n"; prompt($query); go_for_it($query); print $query->end_html; sub prompt { my($query) = @_; print $query->startform; print "Enter Image File Name&nbsp;&nbsp;"; print $query->textfield('name'),"<br>"; print "Enter Width&nbsp;&nbsp;"; print $query->textfield('width'),"<br>"; print "Enter Height&nbsp;&nbsp;"; print $query->textfield('height'),"<br>"; print "Enter Red Hex Value&nbsp;&nbsp;"; print $query->textfield('red_value'),"<br>"; print "Enter Green Hex Value&nbsp;&nbsp;"; print $query->textfield('green_value'),"<br>"; print "Enter Blue Hex Value&nbsp;&nbsp;"; print $query->textfield('blue_value'),"<br>"; print "<p>",$query->reset; print $query->submit('Action','Submit'); print $query->endform; print "<hr>\n"; } sub go_for_it { my($query) = @_; my(@values,$key); print "<H2>Completed with the following values.</H2>"; foreach $key ($query->param) { print "<STRONG>$key</STRONG> -> "; @values = $query->param($key); print join(", ",@values),"<BR>\n"; if ($key =~ /name/i) { our $name = $query->param($key); } elsif ($key =~ /width/i) { our $width = $query->param($key); } elsif ($key =~ /height/i) { our $height = $query->param($key); } elsif ($key =~ /red/i) { our $red = $query->param($key); $red = oct "0x" . $red; } elsif ($key =~ /green/i) { our $green = $query->param($key); $green = oct "0x" . $green; } elsif ($key =~ /blue/i) { our $blue = $query->param($key); $blue = oct "0x" . $blue; } } my $im = new GD::Image(our $width,our $height); my $color = $im->colorAllocate(our $red,our $green,our $blue); $im->fill(1,1,$color); open IMAGE, ">" . our $name . ".png"; print IMAGE $im->png(); close IMAGE; }

In reply to Easy Pixel PNG Generator by bladx

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?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-26 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found