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

Is CGI necessary to reproduce the problem? Can you remove the module and CGI functionality while still getting the error? Maybe consider running the CGI script from the command line instead?

open(LOCAL, ">$imgdir/$name") or print 'error';

Consider outputting the error text to the web server error log instead:

my $filename = open(LOCAL, ">$filename") or die "Could't create '$filename': $!";

Also consider using the approach documented in CGI for file uploads:

use File::Copy 'copy'; my $filehandle = $q->upload( 'uploaded_file' ); my $tmpfilename = $q->tmpFileName( $filehandle ); cp $tmpfilename => $filename;

Replies are listed 'Best First'.
Re^2: Image::Thumbnail work under windows but not on linux
by *alexandre* (Scribe) on Aug 13, 2019 at 13:53 UTC
    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.

      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