Change pixelate function to work with older versions of PHP