public function add_chunks($type, $key, $value) {
        if (strlen($key) > 79) {
            debugging('Key is too big');
        }

        // tEXt Textual data.
        // Keyword:        1-79 bytes (character string)
        // Null separator: 1 byte
        // Text:           n bytes (character string)
        $data = $key . "\0" . $value;
        $crc = pack("N", crc32($type . $data));
        $len = pack("N", strlen($data));

        // Chunk format: length + type + data + CRC.
        // CRC is a CRC-32 computed over the chunk type and chunk data.
        $newchunk = $len . $type . $data . $crc;

        $result = substr($this->_contents, 0, $this->_size - 12)
                . $newchunk
                . substr($this->_contents, $this->_size - 12, 12);

        return $result;
    }
public function add_chunks($type, $key, $value) {
        if (strlen($key) > 79) {
            debugging('Key is too big');
        }

        // tEXt Textual data.
        // Keyword:        1-79 bytes (character string)
        // Null separator: 1 byte
        // Text:           n bytes (character string)
        $data = $key . "\0" . $value;
        $crc = pack("N", crc32($type . $data));
        $len = pack("N", strlen($data));

        // Chunk format: length + type + data + CRC.
        // CRC is a CRC-32 computed over the chunk type and chunk data.
        $newchunk = $len . $type . $data . $crc;

        $result = substr($this->_contents, 0, $this->_size - 12)
                . $newchunk
                . substr($this->_contents, $this->_size - 12, 12);

        return $result;
    }
public function add_chunks ( $ type , $ key , $ value ) { if ( strlen ( $ key ) > 79 ) { debugging ( 'Key is too big' ) ; } // tEXt Textual data. // Keyword:        1-79 bytes (character string) // Null separator: 1 byte // Text:           n bytes (character string) $ data = $ key . "\0" . $ value ; $ crc = pack ( "N" , crc32 ( $ type . $ data ) ) ; $ len = pack ( "N" , strlen ( $ data ) ) ; // Chunk format: length + type + data + CRC. // CRC is a CRC-32 computed over the chunk type and chunk data. $ newchunk = $ len . $ type . $ data . $ crc ; $ result = substr ( $ this -> _contents , 0 , $ this -> _size - 12 ) . $ newchunk . substr ( $ this -> _contents , $ this -> _size - 12 , 12 ) ; return $ result ; }
Adds a chunk with keyword and data to the file content.
Chunk is added to the end of the file, before IEND image trailer.

@param string $type Chunk type, like iTXt, tEXt, etc.
@param string $key Keyword that needs to be added.
@param string $value Currently an assertion URL that is added to an image metadata.

@return string $result File content with a new chunk as a string. Can be used in file_put_contents() to write to a file.
Adds a chunk with keyword and data to the file content . Chunk is added to the end of the file before IEND image trailer .