src/Provider/GeoTIFF/GeoTIFFReader.php
protected function checkByteOrderAndTiffIdentifier()
    {
        fseek($this->FileResource, 0);
        $data = unpack('c2chars/vTIFF_ID', fread($this->FileResource, 4));

        if (static::MAGIC_TIFF_ID !== $data['TIFF_ID']) {
            throw new RuntimeException('Provided GeoTIFF file is not a valid tiff file.');
        }

        $this->ByteOrder = sprintf('%c%c', $data['chars1'], $data['chars2']);

        if ($this->ByteOrder !== static::LITTLE_ENDIAN && $this->ByteOrder !== static::BIG_ENDIAN) {
            throw new RuntimeException('Provided GeoTIFF file has an unknown byte order.');
        }
    }
protected function checkByteOrderAndTiffIdentifier()
    {
        fseek($this->FileResource, 0);
        $data = unpack('c2chars/vTIFF_ID', fread($this->FileResource, 4));

        if (static::MAGIC_TIFF_ID !== $data['TIFF_ID']) {
            throw new RuntimeException('Provided GeoTIFF file is not a valid tiff file.');
        }

        $this->ByteOrder = sprintf('%c%c', $data['chars1'], $data['chars2']);

        if ($this->ByteOrder !== static::LITTLE_ENDIAN && $this->ByteOrder !== static::BIG_ENDIAN) {
            throw new RuntimeException('Provided GeoTIFF file has an unknown byte order.');
        }
    }
protected function checkByteOrderAndTiffIdentifier ( ) { fseek ( $ this -> FileResource , 0 ) ; $ data = unpack ( 'c2chars/vTIFF_ID' , fread ( $ this -> FileResource , 4 ) ) ; if ( static :: MAGIC_TIFF_ID !== $ data [ 'TIFF_ID' ] ) { throw new RuntimeException ( 'Provided GeoTIFF file is not a valid tiff file.' ) ; } $ this -> ByteOrder = sprintf ( '%c%c' , $ data [ 'chars1' ] , $ data [ 'chars2' ] ) ; if ( $ this -> ByteOrder !== static :: LITTLE_ENDIAN && $ this -> ByteOrder !== static :: BIG_ENDIAN ) { throw new RuntimeException ( 'Provided GeoTIFF file has an unknown byte order.' ) ; } }
Go to the file header and work out the byte order (bytes 0-1) and TIFF identifier (bytes 2-3).
@throws RuntimeException
Go to the file header and work out the byte order ( bytes 0 - 1 ) and TIFF identifier ( bytes 2 - 3 ) .