Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ImageResize;
- use strict;
- use warnings;
- use nginx;
- use Image::Imlib2;
- Image::Imlib2->set_cache_size(0);
- sub handler {
- my $r = shift;
- my ($file) = split /\?/, $r->uri;
- $file = "/tmp$file";
- unless (-e $file) {
- return DECLINED;
- }
- my $im = Image::Imlib2->load($file);
- my $im2 = $im->create_scaled_image( 150, 100 );
- $im2->set_quality(75);
- $im2->save("/tmp/img/$$.jpg");
- $r->internal_redirect("/_img/$$.jpg");
- return OK;
- }
- 1;
Add Comment
Please, Sign In to add comment