Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub post_image {
- my $self = shift;
- my $upload = $self->req->upload('file');
- # Work out what we're going to call the file
- # Store it in the same place the ftp daemon does
- my $filename = $upload->filename;
- my $original = '/home/ftp/' . $filename;
- $upload->move_to($original);
- my $image = Image->new(file => $original); # could load from the file asset file handle...
- my @files = $image->make_thumbnails(); #long slow routine to make 4 thumbnails of the original image.
- # Announce to redis if there have been any new files created
- if (@files) {
- my $r = Redis->new;
- $r->publish('new_image', $filename);
- $r->rpush('images', $filename);
- }
- my $result_url = $self->url_for('current', id => time()); #totally bogus, will break any *real* gallery3 apps
- $self->render(
- json => {url => $result_url},
- format => 'json',
- status => 201,
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement