The only thing I see at the moment is that in ($x, $y) = imgsize($image); and only there you are using a relative path. readdir does not return an absolute path; try ($x, $y) = imgsize("/home/dstefani/digi/image_uploads/$image"); instead and see if it works.
Hope this helped. CombatSquirrel.
Entropy is the tendency of everything going to hell.