-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of extra functions regarding issue #1
- Loading branch information
Showing
2 changed files
with
206 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Welcome to PNGMetadata! | ||
# Welcome to PNGMetadata! | ||
|
||
PNGMetadata is a library which is able to extract the metadata of an image in png format. | ||
|
||
|
@@ -53,7 +53,7 @@ $metadata_array = PNGMetadata::extract('Photo.png')->toArray(); // return simple | |
|
||
## Examples | ||
|
||
### Example 1 | ||
### Example 1 - All | ||
|
||
Print all the metadata. | ||
|
||
|
@@ -71,7 +71,7 @@ Out: | |
| exif:MimeType | image/png | | ||
| ... | ... | | ||
|
||
### Example 2 | ||
### Example 2 - Get Metadata | ||
|
||
Get specific metadata. | ||
|
||
|
@@ -80,7 +80,7 @@ $png_metadata = new PNGMetadata(___DIR___.'/Photo.png'); | |
echo $png_metadata->get('exif:DateTime'); // Return a value, a array or false. | ||
``` | ||
|
||
### Example 3 | ||
### Example 3 - Types | ||
|
||
Print the metadata types (IHDR, SRBG, BKGD, EXIF, XMP, CRS, DATE, DC, ICC, AUX, ...). | ||
|
||
|
@@ -94,6 +94,43 @@ foreach($png_metadata as $key => $value){ | |
} | ||
``` | ||
|
||
## Extras Functions | ||
|
||
### Get the thumbnail stored in the metadata! | ||
```php | ||
$png_metadata = new PNGMetadata('../Photo.png'); | ||
// or | ||
$png_metadata = PNGMetadata::extract('../Photo.png'); | ||
|
||
$thumb = $png_metadata->getThumbnail(); | ||
|
||
if ($thumb !== false) { | ||
header('Content-Type: image/png'); | ||
imagepng($thumb); | ||
imagedestroy($thumb); | ||
} | ||
``` | ||
|
||
### Is PNG? | ||
```php | ||
if (PNGMetadata::isPNG('./Photo_jpg.png')){ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
echo 'Yes, it is a PNG.'; | ||
}else{ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
echo 'No, it is not a PNG.' | ||
} | ||
``` | ||
|
||
### What type? | ||
| | | | | | | | ||
|:----------:|:----------:|:--------:|:-------:|:--------:|:-------:| | ||
| GIF(1) | JPEG(2) | PNG (3) | SWF(4) | PSD(5) | BMP(6) | | ||
| TIFF_II(7) | TIFF_MM(8) | JP2 (10) | JPX(11) | JB2(12) | SWC(13) | | ||
| IFF(14) | WBMP(15) | XBM(16) | ICO(17) | WEBP(18) | | | ||
|
||
```php | ||
return PNGMetadata::getType('./Photo') == 1 // GIF? | ||
This comment has been minimized.
Sorry, something went wrong.
janbarasek
Contributor
|
||
``` | ||
|
||
## License | ||
|
||
The GNU Public License (GPLv3). Please see [License File](https://github.com/joserick/PNGMetadata/blob/master/LICENSE) for more information. |
Oops, something went wrong.
CS:
)){
=>)) {