in reply to Re: Re: Re: GD.pm copyResized / copyResampled errors
in thread GD.pm copyResized / copyResampled errors

Well, that is one problem, but that wasn't the trouble I was having... Here you can see the original and the thumbnail that I ended up with: http://viehland.org/gd-images/index.html It's like the program forgets what it's doing and it just quits in the middle...
  • Comment on Re: Re: Re: Re: GD.pm copyResized / copyResampled errors

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: GD.pm copyResized / copyResampled errors
by Roger (Parson) on Feb 05, 2004 at 03:27 UTC
    Can you spot the problem in your code below?
    if ((($fileWidth gt $maxThumbSize) || ($fileHeight gt $maxThumbSize)) +|| ($retype eq "yes")) { if ($fileWidth gt $fileHeight) { $scalefactor=$maxThumbSize/$fileW +idth; } else { $scalefactor=$maxThumbSize/$fileHeight; } $thumbWidth = int($fileWidth*$scalefactor); $thumbHeight = int($fi +leHeight*$scalefactor); } else { $thumbWidth=$fileWidth; $thumbHeight=$fileHeight; }

    You are comparing numeric values with gt. That means '6 gt 12' is going to be true. 'gt' and 'lt' compare string values, not numeric values, you should always use '<' and '>' instead to compare numeric values.

    And also you can turn on binmode regardless of operating system. That will have no effect on Unix anyway, but will make a big difference under Windows.

      Again, that is one problem, but that wasn't the trouble I was having... Even after changing the gt to > and lt to <, I still am having the same trouble. Here you can see the original and the thumbnail that I ended up with: Images. It's like the program forgets what it's doing and it just quits in the middle... It does this on multiple servers and with different files. Any thoughts on this?