From d2bd6dbc521bba6ebee4793ac021a74db9c1210f Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Tue, 12 Apr 2005 14:41:28 +0000 Subject: [PATCH] - added sample code for handling images uploaded via a HTML form. --- Changes | 1 + MANIFEST | 4 ++++ TODO | 4 ++-- lib/Imager/Cookbook.pod | 6 ++++++ samples/README | 22 ++++++++++++++++++++++ 5 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 2c156342..171951fd 100644 --- a/Changes +++ b/Changes @@ -1046,6 +1046,7 @@ Revision history for Perl extension Imager. demonstrate displaying a generated image on a HTML page. - Makefile.PL now adds rules to generate a suitable META.yml to the generated Makefile. +- added sample code for handling images uploaded via a HTML form. ================================================================= diff --git a/MANIFEST b/MANIFEST index aa00c1a2..ecf42e7d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -108,6 +108,10 @@ samples/anaglyph.pl samples/interleave.pl samples/samp-form.cgi samples/samp-image.cgi +samples/samp-scale.cgi Demonstrate image upload via a HTML form +samples/samp-scale.html Form for samp-scale.cgi +samples/samp-tags.cgi Demonstrate image upload via a HTML form +samples/samp-tags.html Form for samp-tags.cgi spot.perl For making an ordered dither matrix from a spot function stackmach.c stackmach.h diff --git a/TODO b/TODO index 5826665b..936a3710 100644 --- a/TODO +++ b/TODO @@ -10,11 +10,11 @@ not commitments. - audit pnm.c (done) - audit tga.c (done) - audit rgb.c and add tests -- add META.yml (bypass EU::MM's limited mechanism) +- add META.yml (bypass EU::MM's limited mechanism) (done) - implement i_incomplete for bmp files - check if freetype 2 is faster/slower than freetype 1 with Imager's glyph caching. If FT1 is faster, add caching as a TODO for FT2. -- add sample CGI that handles an uploaded image +- add sample CGI that handles an uploaded image (done) - examples for fountain filter in Imager::Filters - allow Imager::Fountain to take color descriptions (eg. blue, FF000) instead of color objects for c0 and c1. diff --git a/lib/Imager/Cookbook.pod b/lib/Imager/Cookbook.pod index b82f6970..6ec76ab9 100644 --- a/lib/Imager/Cookbook.pod +++ b/lib/Imager/Cookbook.pod @@ -142,6 +142,9 @@ scalar as a buffer: binmode STDOUT; print $data; +See C and C for a +couple of simple examples of producing an image from CGI. + =head2 Inserting a CGI image in a page There's occasionally confusion on how to display an image generated by @@ -220,6 +223,9 @@ have Imager read the image } # else, the user didn't select a file +See C and C in the +Imager distribution for example code. + =head1 DRAWING =head1 TEXT diff --git a/samples/README b/samples/README index 959d2e3b..e2a27e8d 100644 --- a/samples/README +++ b/samples/README @@ -28,3 +28,25 @@ samp-image.cgi The POD for this sample discusses alternate approaches and security considerations. + +samp-scale.html +samp-scale.cgi + + Example that demonstrates reading an image uploaded via a HTML form. + + Produces an output image scaled to fit inside 200x200. + +samp-tags.html +samp-tags.cgi + + Example that demonstrates reading an image uploaded via a HTML form. + + Produces a text/plain report of the tags that Imager defined for the + image. + + This and the previous sample are very similar, the intent is to show + the common elements and to demonstrate that the output is independent + of the input. + + See the section "Parsing an image posted via CGI" in Imager::Cookbook + for cautions and details on reading uploaded images. -- 2.39.5