in reply to Re: Image::Thumbnail work under windows but not on linux
in thread Image::Thumbnail work under windows but not on linux

Hi, I Added die directive but still no error, the image file is still uploaded but thumb not created. I checked if GD, Image::Thumbnail was correctly installed but Don't find any error.
  • Comment on Re^2: Image::Thumbnail work under windows but not on linux

Replies are listed 'Best First'.
Re^3: Image::Thumbnail work under windows but not on linux
by Corion (Patriarch) on Aug 13, 2019 at 14:18 UTC

    Which directive did you add, and where?

    Maybe consider outputting the progress of your script using warn to the error log.

    As you already have the appropriate input file in /var/www/upload/test_upload_and_thumb.jpg, you can simply call createImageMagickThumb("$name"); in another program from the shell to test it.

      Hi Here the the code snippet I'm been using :
      #!/usr/bin/perl use warnings; use strict; use Image::Thumbnail; my $imgdir= "/var/www/upload"; createImageMagickThumb('testFileUploadAndThumb.jpg'); sub createImageMagickThumb { my $filename = shift || ''; print "file name : $filename\n"; print "file directory $imgdir\n"; my $t = new Image::Thumbnail( size => 100, create => 1, input => "$imgdir/$filename", outputpath => "$imgdir/thumb.$filename", ); print "input => $imgdir/$filename\n"; print "outputpath => $imgdir/thumb.$filename\n"; }
      and here is the console view
      root@vps8279:/usr/lib/cgi-bin# perl thumb.pl file name : testFileUploadAndThumb.jpg file directory /var/www/upload input => /var/www/upload/testFileUploadAndThumb.jpg outputpath => /var/www/upload/thumb.testFileUploadAndThumb.jpg
      In my upload directory I still doesn't have a thumb.testFileUploadAndThumb.jpg created

        The documentation for Image::Thumbnail shows the following usage:

        use Image::Thumbnail 0.65; # Create a thumbnail from 'test.jpg' as 'test_t.jpg' # using ImageMagick, Imager, GD or Image::Epeg. my $t = new Image::Thumbnail( size => 55, create => 1, input => 'test.jpg', outputpath => 'test_t.jpg', ); # Create four more of ever-larger sizes for (1..4){ $t->{size} = 55+(10*$_); $t->create; }

        I don't see any call to ->create in your code. Did you forget that call?

        Update: Now I see - create => 1 is supposed to automatically create the thumbnail. If you use the automatic way, you won't get access to the error diagnostics, so I would look at the manual way first, to see the potential error messages:

        my $t = new Image::Thumbnail( size => 55, create => 1, input => 'test.jpg', outputpath => 'test_t.jpg', ); $t->create; print "Errors : " . $t->{error, "\n"; print "Warnings:" . $t->{warning}, "\n";

        Upon reading the source code, it seems as the module does not actually set up those fields in most situations.