note
hippo
<p>I've turned this into an [id://1177642|SSCCE] (as you should have done). It works perfectly.</p>
<code>
#!/usr/bin/env perl
use strict;
use warnings;
use Image::Thumbnail;
use LWP::UserAgent;
use Test::More tests => 2;
my $file = 'test.jpeg';
my $imgdir = '.';
my $ua = LWP::UserAgent->new;
my $url = 'https://www.perlmonks.org/?updated=20180808044221;node_id=1000135';
my $res = $ua->mirror ($url, $file);
ok -e $file, 'Image downloaded';
createImageMagickThumb ($file);
ok -e "thumb.$file", 'Thumbnail created';
my $query; # Used in code from 11149409 only
# Code from 11149409 follows, unaltered.
sub uploadImage {
my $name = shift || '';
my $file = $query->param('image');
open(LOCAL, ">$imgdir/$name.jpg") or print 'error';
my $file_handle = $query->upload('image');
binmode LOCAL;
while(<$file_handle>) {
print LOCAL;
}
close($file_handle);
close(LOCAL);
createImageMagickThumb("$name.jpg");
}
sub createImageMagickThumb {
my $filename = shift || '';
my $t = new Image::Thumbnail(
size => 100,
create => 1,
module => 'Imager',
input => "$imgdir/$filename",
outputpath => "$imgdir/thumb.$filename",
);
}
</code>
<blockquote><i>The code worked well until a few days ago. Any idea what could be wrong ?
</i></blockquote>
<p>Yes. You changed something a few days ago which broke it. Restore the machine from the backup you took a few days ago and everything will be fine.</p>
<blockquote><i>The image file is well uploaded but no thumb created. Thanks</i></blockquote>
<p>Well then, why not check for errors? See the [Basic Debugging Checklist], [https://metacpan.org/pod/Image::Thumbnail#ERRORS] and [id://1154672].</p>
<div class="pmsig"><div class="pmsig-885521">
<hr /><p>🦛
</p>
</div></div>
11149409
11149409