in reply to Re^2: image resize error
in thread image resize error

So, why do you expect things to work that way if you did not find the usage documented?

The next step is for you to read the documentation of Image::Resize and to change your code so it fits the documentation.

Your English description of what the two lines do is wrong - there is no line of code that is uploading an image. There is only a line that returns a filehandle of a file that was already uploaded to your server. You then use that filehandle as an argument to Image::Resize.

Replies are listed 'Best First'.
Re^4: image resize error
by bigup401 (Pilgrim) on Oct 19, 2018 at 10:39 UTC

    well. i think the image resize does't get my pic, i tried the Image Resize module locally without cgi and works

    but with cgi script i get

    Image::Resize->new(): file '02111.JPG' does not exist
    #!/usr/bin/perl use strict; use warnings; use CGI; use File::Copy; use CGI::Carp 'fatalsToBrowser'; my $q = CGI->new; my $photo = $q->param("pic"); if ($photo){ my ($ext) = $photo =~ /([^.]+)$/; my $copydir = '/full/path/to/web/img/'; my $image = Image::Resize->new($photo); my $gd = $image->resize(100, 100); my $newfile = $copydir."011190.$ext"; my $upload_fh = $q->upload("pic"); open OUTFILE,'>',$newfile or die "$!"; print OUTFILE $gd->jpeg(); binmode OUTFILE; while (<$upload_fh>){ print OUTFILE; } close OUTFILE; } print << "HTM"; <h2>File upload</h2> <form method="post" action="" enctype="multipart/form-data"> Filename: <input type="file" name="pic"/><br/><br/> <input type="submit"/> </form> HTM

      "well. i think the image resize does't get my pic"

      You call Image::Resize->new before you've uploaded a file, passing the filename. In English, upload the file (covered in the CGI documentation), then resize your image.

        Hi Marto,

        How many times have you already told this user to just do the basics?

        I can hardly imagine someone being so ignorant, looks a lot like a clever troll.

        Either way, maybe better stop feeding! :)

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      A reply falls below the community's threshold of quality. You may see it by logging in.
A reply falls below the community's threshold of quality. You may see it by logging in.