Image::Empty - Empty/transparent 1x1 pixel images for use in tracking URLs.
Version 0.04
Create 1x1 pixel empty/transparent GIFs to use in tracking URLs.
my $empty_gif = Image::Empty->gif; print CGI->new->header( -type => $empty_gif->type, -Content_length => $empty_gif->length ); print $empty_gif->content;
Or
my $gif = Image::Empty->gif; $gif->render( CGI->new );
Or, if running under Plack
my $gif = Image::Empty->gif; return $gif->render( Plack::Response->new );
$empty_image->type;
Returns the mime/type of the image for use in HTTP headers.
$empty_image->length;
Returns the content length for use in HTTP headers.
$empty_image->disposition;
Returns the content disposition for use in HTTP headers.
$empty_image->filename;
Returns the content filename for use in HTTP headers.
$empty_image->content;
Returns the image data to send in the HTTP response body.
my $gif = Image::Empty->gif;
Returns an instance representing an empty GIF for use in responding to HTTP requests.
To be lazy, you can supply a CGI object to the render method to have the HTTP header and content set for you.
render
A string is returned for you to print, so you can condense this down to a single line by chaining methods.
print Image::Empty->gif->render( CGI->new );
It is the same as doing:
my $gif = Image::Empty->gif; print CGI->new->header( -type => $gif->type, -Content_length => $gif->length, -Content_disposition => $gif->disposition . '; filename="' . $gif->filename . '"', ); print $gif->content;
If you are working under Plack, this module supports that too.
Unlike the CGI approach above, this scenario returns the finalized Plack::Response object.
CGI
finalized
my $app = sub { return Image::Empty->gif->render( Plack::Response->new ); }
Rob Brown, <rob at intelcompute.com>
<rob at intelcompute.com>
Please report any bugs or feature requests to bug-image-empty at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Image-Empty. I will be notified, and then you will automatically be notified of progress on your bug as I make changes.
bug-image-empty at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Image::Empty
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Image-Empty
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Image-Empty
CPAN Ratings
http://cpanratings.perl.org/d/Image-Empty
Search CPAN
http://search.cpan.org/dist/Image-Empty/
I can not actually remember where the original line came from to produce the gif content.
Copyright 2012 Rob Brown.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Image::Empty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Image::Empty
CPAN shell
perl -MCPAN -e shell install Image::Empty
For more information on module installation, please visit the detailed CPAN module installation guide.