Mailinglisten-Archive |
Hallo Florian, nun da du so lieb drum bittest: function jpeg_getcompression($path) { $sof=-1; $f=fopen($path,'rb'); while (!feof($f)) { $c1=ord(fread($f,1)); if ($c1==0xff) { $c2=ord(fread($f,1)); if ($c2==0xd8) { // Start Of Image //do nothing } else if ($c2==0xd9) { // End of Image break; //end } else if ((($c2>=0xc0) && ($c2<=0xc3)) || (($c2>=0xc5) && ($c2<=0xc7)) || (($c2>=0xc9) && ($c2<=0xcb)) || (($c2>=0xcd) && ($c2<=0xcf))) { // Start of Frame Marker $sof=$c2-0xc0; break; //we can stop now } else if ($c2==0xda) { // Start of Scan $end=false; $c4=$c2; while (!feof($f)) { $c3=$c4; $c4=ord(fread($f,1)); if (($c3==0xff) && ($c4!=0x00)) { $end=true; break; } } if ($end) { fseek($f,-2,SEEK_CUR); } } else { // any other segment $c3=ord(fread($f,1)); $c4=ord(fread($f,1)); $length=($c3*256+$c4)-2; fseek($f,$length,SEEK_CUR); } } else { // 0xff expected - data error break; } } fclose($f); return $sof; } Return Code: -1 - Fehler 0 - Baseline DCT 1 - Extended sequential DCT 2 - Progressive DCT 3 - Lossless (sequential) 5 - Differential sequential DCT 6 - Differential progressive DCT 7 - Differential lossless (sequential) 9 - Extended sequential DCT 10 - Progressive DCT 11 - Lossless (sequential) 13 - Differential sequential DCT 14 - Differential progressive DCT 15 - Differential lossless (sequential) LG, Andreas
php::bar PHP Wiki - Listenarchive