Quote:
Originally Posted by paul41598
I just tried uploading a pic of an animated GIF, that is 120 pixels. I set the max width to 90 in my CP.
This is the error Im getting with an animated gif:
PHP Code:
Warning: imagecreatetruecolor(): Invalid image dimensions in /includes/functions_geekautoavatar.php on line 44
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /includes/functions_geekautoavatar.php on line 45
Warning: imagegif(): supplied argument is not a valid Image resource in /includes/functions_geekautoavatar.php on line 53
Warning: imagedestroy(): supplied argument is not a valid Image resource in /includes/functions_geekautoavatar.php on line 58
|
AHA! I figured it out!
I had the same problem with a jpeg that was perfectly square. The problem lies in the function starting at line 30.
Code:
//decide which is the % of shrinkage to use
if ($shrinkx<$shrinky){
$ratio=$shrinkx;
}elseif($shrinky<$shrinkx){
$ratio=$shrinky;
}
What's happening is that since it's square, the ratios are the same and there's no condition to handle it so it sets $ratio to 0
The fix is simple
Code:
//decide which is the % of shrinkage to use
if ($shrinkx<$shrinky){
$ratio=$shrinkx;
}elseif($shrinky<$shrinkx){
$ratio=$shrinky;
}else{
$ratio=$shrinkx;
}
Just set ratio to one of the 2 shrink values.
Hope this helps you all out!