I've turned this into an SSCCE (as you should have done). It works perfectly.

#!/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_i +d=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", ); }
The code worked well until a few days ago. Any idea what could be wrong ?

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.

The image file is well uploaded but no thumb created. Thanks

Well then, why not check for errors? See the Basic Debugging Checklist, https://metacpan.org/pod/Image::Thumbnail#ERRORS and How to ask better questions using Test::More and sample data.


🦛


In reply to Re: Image::Thumbnail creation fails by hippo
in thread Image magic creation of thumb fail by *alexandre*

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.