Can teach you the simplest way, for a JPG format picture, see whether the last two bytes are FFD9
If not, then it is generally not normal. In other formats, this method of judging is not applicable.
Normal JPG files start with FFD8, FFD9 end, if you lose the tail of the file, JPG can still be recognized, but will lose some of the image data.
--------
Of course, I said this is a simple judgment, may be lost before the end of the paragraph is just FFD9, but obviously still not correct, but basic enough. If the pursuit of rigor, then you have to read the JPEG format Specification document,
This does not belong to the knowledge category of PHP.
I've tried to determine the image format and pixels
You obviously can't, not deep enough, to be rigorous, you have to understand the storage of JPG.
As for the PHP tutorial of the GD library has a corresponding judgment function, I did not pay attention to, you can Google, I will not say more. You're welcome to study it and share it.
Share a PHP file that reads jpg
$adress = "img_xxx. JPG ";
$exif = Read_exif_data ($adress);
while (list ($k, $v) =each ($exif)) {
if ($k = = "Thumbnail") {
$FP =fopen ("/www/home/image/thumbnail$adress",
' A ');
Fwrite ($fp, $v);
Fclose ($FP);
echo "
n ";
echo "n";
echo "
n ";
}else{
echo "$k: $v
n ";
}
}
http://www.bkjia.com/PHPjc/632975.html www.bkjia.com true http://www.bkjia.com/PHPjc/632975.html techarticle can teach you the simplest way, for a JPG format picture, see whether the last two bytes is FFD9 if not, then generally is not normal. If it's a different format, this ...