port over article http://brett.is/writing/about/php-stop-malicious-image-uploads/