Baking badges library.
Author: | Yuliya Bozhko <yuliya.bozhko@totaralms.com> |
Copyright: | 2012 onwards Totara Learning Solutions Ltd {@link http://www.totaralms.com/} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 177 lines (6 kb) |
Included or required: | 1 time |
Referenced: | 0 times |
Includes or requires: | 0 files |
PNG_MetaDataHandler:: (3 methods):
__construct()
check_chunks()
add_chunks()
Class: PNG_MetaDataHandler - X-Ref
Information on PNG file chunks can be found at http://www.w3.org/TR/PNG/#11Chunks__construct($contents) X-Ref |
Prepares file for handling metadata. Verifies that this file is a valid PNG file. Unpacks file chunks and reads them into an array. param: string $contents File content as a string |
check_chunks($type, $check) X-Ref |
Checks if a key already exists in the chunk of said type. We need to avoid writing same keyword into file chunks. param: string $type Chunk type, like iTXt, tEXt, etc. param: string $check Keyword that needs to be checked. return: boolean (true|false) True if file is safe to write this keyword, false otherwise. |
add_chunks($type, $key, $value) X-Ref |
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. |