Baking badges - PNG metadata handler.
More...
|
| __construct (string $contents) |
| Prepares file for handling metadata.
|
|
| add_chunks (string $type, string $key, string $value) |
| Adds a chunk with keyword and data to the file content.
|
|
| check_chunks (string $type, string $check) |
| Checks if a key already exists in the chunk of said type.
|
|
Baking badges - PNG metadata handler.
- Copyright
- 2012 onwards Totara Learning Solutions Ltd
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- Author
- Yuliya Bozhko yuliy.nosp@m.a.bo.nosp@m.zhko@.nosp@m.tota.nosp@m.ralms.nosp@m..com
◆ __construct()
core_badges\png_metadata_handler::__construct |
( |
string | $contents | ) |
|
Prepares file for handling metadata.
Verifies that this file is a valid PNG file. Unpacks file chunks and reads them into an array.
- Parameters
-
string | $contents | File content as a string |
◆ add_chunks()
core_badges\png_metadata_handler::add_chunks |
( |
string | $type, |
|
|
string | $key, |
|
|
string | $value ) |
Adds a chunk with keyword and data to the file content.
Chunk is added to the end of the file, before IEND image trailer.
- Parameters
-
string | $type | Chunk type, like iTXt, tEXt, etc. |
string | $key | Keyword that needs to be added. |
string | $value | Currently an assertion URL that is added to an image metadata. |
- Return values
-
string#$result | File content with a new chunk as a string. Can be used in file_put_contents() to write to a file. |
- Exceptions
-
moodle_exception | when unsupported chunk type is defined. |
◆ check_chunks()
core_badges\png_metadata_handler::check_chunks |
( |
string | $type, |
|
|
string | $check ) |
Checks if a key already exists in the chunk of said type.
We need to avoid writing same keyword into file chunks.
- Parameters
-
string | $type | Chunk type, like iTXt, tEXt, etc. |
string | $check | Keyword that needs to be checked. |
- Return values
-
boolean | (true|false) True if file is safe to write this keyword, false otherwise. |
The documentation for this class was generated from the following file:
- badges/classes/png_metadata_handler.php