Plack::Middleware::Image::Dummy - Dummy image responser for Plack
## example.psgi builder { # basic enable 'Image::Dummy', map_path => '/', font_path => './font/MTLmr3m.ttf'; # map path with regex enable 'Image::Dummy', map_path => qr/^\//, font_path => './font/MTLmr3m.ttf'; # change max_width and max_height enable 'Image::Dummy', map_path => '/', font_path => './font/MTLmr3m.ttf', max_width => 100, max_height => 200; # with param_filter enable 'Image::Dummy', map_path => '/', font_path => './font/MTLmr3m.ttf', param_filter => sub { my $params = shift; if ($ENV{PLACK_ENV} eq 'production') { print STDERR "Do not show under production environment.\n"; undef; } else { $params->{text} .= ':D'; $params; } }; $app; };
Plack::Middleware::Image::Dummy is dummy image responser for Plack like http://dummyimage.com/.
URI path mapped to this module.
Font path.
Max width of image. Default is 2048.
Max height of image. Default is 2048.
A code reference. The code called with one HashRef contains parsed parameters. Evaluated value is used in image creation.
You can get a image detailed in URI like below.
http://host:port#{map_path}/#{width}x#{height}.#{ext}?param=value&...
You can specify width, height and file type (ex. png, gif, jpg) in path of URI.
You can specify text written in the center of the image. Default is #{width}x#{height}.
You can specify text color with 'RRGGBB'. ex.) ff0000 is red.
You can specify background color with 'RRGGBB'. ex.) 00ff00 is green.
You can specify minimum size of font.
Tasuku SUENAGA a.k.a. gunyarakun <tasuku-s-cpan ATAT titech.ac>
https://github.com/gunyarakun/p5-Plack-Middleware-Image-Dummy
git clone git://github.com/gunyarakun/p5-Plack-Middleware-Image-Dummy.git
Imager
Imager::File::GIF
Files in 'font' directory are licensed under the Apache License 2.0.
Copyright (C) Tasuku SUENAGA a.k.a. gunyarakun
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Plack::Middleware::Image::Dummy, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plack::Middleware::Image::Dummy
CPAN shell
perl -MCPAN -e shell install Plack::Middleware::Image::Dummy
For more information on module installation, please visit the detailed CPAN module installation guide.