This is a crazy idea. You're not just tying up the server in converting between image formats, you're also degrading the quality of every uploaded image.
I'd recommend a different approach
When a file is uploaded, use PHP's getimagesize() function to check the image. If this function returns
FALSE
(or an unexpected image type, or strange dimensions, etc.), then the file is corrupt and can be deleted.Use exiftool or something similar to strip away all the metadata from the uploaded file before you store it away on the server. That way you can ensure that the file only contains image data.
Perhaps you could check that the value of
$_FILES["file"]["name"]
doesn't contain anything sneaky like../../
before you use it to save the file on your server.