function getStdJpegData() { if (count($this->_jpegChunk) == 0) { $this->_splitChunk(false, false); } $bitout = new IO_Bit(); foreach ($this->stdChunkOrder as $stdMarker) { foreach ($this->_jpegChunk as $chunk) { $marker = $chunk['marker']; if ($stdMarker == $marker) { $bitout->putUI8(0xff); $bitout->putUI8($marker); if (!is_null($chunk['length'])) { $bitout->putUI16BE($chunk['length']); } $bitout->putData($chunk['data']); if ($marker == 0xd8 || $marker == 0xd9) { break; // SOI | EOI } } } } return $bitout->output(); }