in reply to Re^3: Image magic creation of thumb fail
in thread Image magic creation of thumb fail

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

Replies are listed 'Best First'.
Re^5: Image magic creation of thumb fail
by marto (Cardinal) on Jan 08, 2023 at 12:14 UTC

    "Hm don't see what's wrong within open and die,"

    It's nothing to do with the myriad of problems you've created for yourself, however I said

    "use $! when calling die to tell you why the open failed."

    So that if/when your code dies while opening, you actually print out the reason why, rather than just printing "error", without telling you what the error was.

    The documentation for open and the other link I provided explain clearly why three argument open is preferred, and also illustrate the use of or die "Can't write file: $!"; described above.

Re^5: Image magic creation of thumb fail
by LanX (Saint) on Jan 07, 2023 at 23:23 UTC
    >
    Have \xampp\perl\lib Want \strawb~1\perl\lib Your perl and your Config.pm seem to have different ideas about the architecture they are running on.

    Looks like you are messing around with two different Perl installations, which would also explain why the modules aren't found.

    Cheers Rolf
    (addicted to the 𐍀𐌴𐍂𐌻 Programming Language :)
    Wikisyntax for the Monastery

      Yes I see it now, I updated the PATH within C:\Strawb~1\c\bin;%PATH% and PERL_HOME to point to C:\Strawberry\perl\bin but I still have conflict between two version of perl. Awesome I run my program within the correct bin path and it's worked again thank you. EDIT The script run well within command line but I got an exception while I'm been running it as a CGI script
      #!C:/Strawberry/perl/bin/perl.exe -w use warnings; use Image::Thumbnail; use CGI; use CGI::Cookie; use Time::HiRes qw(gettimeofday); use CGI::Lite (); my $query = CGI->new ; $imgdir= "C:/Users/41786/OneDrive/Documents/recordz1/upload"; #my $t = new Image::Thumbnail( # module => 'Imager', # size => 55, # create => 1, # input => "$imgdir/282.jpg", # outputpath => "$imgdir/test.jpg", #); # With Image Magick my $file = $query->param("image"); print "Content-Type: text/html\n\n"; my $t = new Image::Thumbnail( size => "55x75", create => 1, module => "Image::Magick", input => "$imgdir/282.jpg", outputpath => "$imgdir/test2.jpg"); print "test";
      Leave me and exception within Magick.xs.dll is not loaded.
        Now everyhings works well here is simple full cript
        #!C:/Strawberry/perl/bin/perl.exe -w use warnings; use Image::Thumbnail; use CGI; use Image::Magick; my $query = CGI->new ; $imgdir= "C:/Users/41786/OneDrive/Documents/recordz1/upload"; # With Image Magick my $file = $query->param("image"); uploadImage("1.jpg"); sub uploadImage { my $name = shift || ''; my $file = $query->param('image'); open(LOCAL, ">$imgdir/$name") or print 'error'; my $file_handle = $query->upload('image'); + binmode LOCAL; while(<$file_handle>) { print LOCAL; } close($file_handle); close(LOCAL); $t = new Image::Thumbnail( size => "55x75", create => 1, module => "Image::Magick", input => "$imgdir/$file", outputpath => "$imgdir/thumb.$name.jpg"); }