Hai già provato imagecopyresampled?