src/PelIfd.php
public function setThumbnail(PelDataWindow $d)
    {
        $size = $d->getSize();
        /* Now move backwards until we find the EOI JPEG marker. */
        while ($d->getByte($size - 2) != 0xFF || $d->getByte($size - 1) != PelJpegMarker::EOI) {
            $size --;
        }

        if ($size != $d->getSize()) {
            Pel::maybeThrow(new PelIfdException('Decrementing thumbnail size ' . 'to %d bytes', $size));
        }
        $this->thumb_data = $d->getClone(0, $size);
    }
public function setThumbnail(PelDataWindow $d)
    {
        $size = $d->getSize();
        /* Now move backwards until we find the EOI JPEG marker. */
        while ($d->getByte($size - 2) != 0xFF || $d->getByte($size - 1) != PelJpegMarker::EOI) {
            $size --;
        }

        if ($size != $d->getSize()) {
            Pel::maybeThrow(new PelIfdException('Decrementing thumbnail size ' . 'to %d bytes', $size));
        }
        $this->thumb_data = $d->getClone(0, $size);
    }
public function setThumbnail ( PelDataWindow $ d ) { $ size = $ d -> getSize ( ) ; /* Now move backwards until we find the EOI JPEG marker. */ while ( $ d -> getByte ( $ size - 2 ) != 0xFF || $ d -> getByte ( $ size - 1 ) != PelJpegMarker :: EOI ) { $ size -- ; } if ( $ size != $ d -> getSize ( ) ) { Pel :: maybeThrow ( new PelIfdException ( 'Decrementing thumbnail size ' . 'to %d bytes' , $ size ) ) ; } $ this -> thumb_data = $ d -> getClone ( 0 , $ size ) ; }
Set thumbnail data.

Use this to embed an arbitrary JPEG image within this IFD. The
data will be checked to ensure that it has a proper {@link
PelJpegMarker::EOI} at the end. If not, then the length is
adjusted until one if found. An {@link PelIfdException} might be
thrown (depending on {@link Pel::$strict}) this case.

@param PelDataWindow $d
the thumbnail data.
Set thumbnail data .