Plack::App::DummyBox - generate dummy box image for web development
# app.psgi use Plack::App::DummyBox; my $dummy_box_app = Plack::App::DummyBox->new->to_app; # then map it use Plack::Builder; builder { mount "/dummy_box" => $dummy_box_app; };
Plack::App::DummyBox generates dummy box images. You can easily get dot images(1x1 git/png) or free size box images. This module may help your designers to make mock of service.
You can set query parameters every request.
box width size(pixel). w is alias as width: default 1
box height size(pixel). h is alias as height: default 1
extension of image: gif or png, default gif
gif
png
color of box: default white
white
border color of box: default gray
gray
size of border line(pixel): default 1
my $dummy_box_app = Plack::App::DummyBox->new( max_width => 640, max_height => 480, font => +{ file => "/path/to/font_file.ttf", type => "ft2", size => 15, # option color => 'red', # option }, text => "foo", filter => sub { my ($self, $img) = @_; # .. do something .. }, cache => Cache::File->new(cache_root => '/tmp/cache'), stderr => 1, )->to_app;
if the size was over, response HTTP STATUS: 400.
If you want to see image size as text on the image, you should set font option. see Imager::Font
font
add a text in the image. text option also requires font option. Note that text string should be decoded utf8 text when it included not ascii strings.
text
filter should code reference. This method receives the $self and Imager object.
If you want to cache responses between requests, provide the cache parameter with an object supporting the Cache API(e.g. Cache::File). Specifically, an object that supports $cache->get($key) and $cache->set($key, $value, $expires).
cache
print error message to STDERR when some error was happen.
return HTTP status and message.
Plack::App::DummyBox is hosted on github <http://github.com/bayashi/Plack-App-DummyBox>
Dai Okabayashi <bayashi@cpan.org>
"Plack::Component ", Image::Empty, Imager
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
1 POD Error
The following errors were encountered while parsing the POD:
L<> starts or ends with whitespace
To install Plack::App::DummyBox, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::App::DummyBox
CPAN shell
perl -MCPAN -e shell install Plack::App::DummyBox
For more information on module installation, please visit the detailed CPAN module installation guide.