Is there an efficient way of detecting if a jpeg file is corrupted?
Background info:
solutions needs to work from within a php script
the jpeg files are on disk
manual checking is no option (user uploaded data)
I know that imagecreatefromjpeg(string $filename);
can do it. But it is quite slow at doing so.
Does anybody know a faster/more efficient solutions?
From the command line you can use jpeginfo to find out if a jpeg file is OK or not.
$ jpeginfo -c test.jpeg
test.jpeg 260 x 264 24bit JFIF N 15332 [OK]
It should be trivial to call jpeginfo from php.