public function getBytes()
    {
        $bytes = '';

        foreach ($this->sections as $section) {
            $m = $section[0];
            $c = $section[1];

            /* Write the marker */
            $bytes .= "\xFF" . PelJpegMarker::getBytes($m);
            /* Skip over empty markers. */
            if ($m == PelJpegMarker::SOI || $m == PelJpegMarker::EOI) {
                continue;
            }

            $data = $c->getBytes();
            $size = strlen($data) + 2;

            $bytes .= PelConvert::shortToBytes($size, PelConvert::BIG_ENDIAN);
            $bytes .= $data;

            /* In case of SOS, we need to write the JPEG data. */
            if ($m == PelJpegMarker::SOS) {
                $bytes .= $this->jpeg_data->getBytes();
            }
        }

        return $bytes;
    }