-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
see #229
- Loading branch information
Showing
7 changed files
with
151 additions
and
35 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
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
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
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
require dirname(__DIR__) . '/vendor/autoload.php'; | ||
|
||
use Jcupitt\Vips; | ||
|
||
function printMetadata($im) | ||
{ | ||
foreach ($im->getFields() as &$name) { | ||
$value = $im->get($name); | ||
if (str_ends_with($name, "-data")) { | ||
$len = strlen($value); | ||
$value = "<$len bytes of binary data>"; | ||
} | ||
echo " $name: $value\n"; | ||
} | ||
} | ||
|
||
$im = Vips\Image::newFromFile($argv[1]); | ||
echo "$argv[1]\n"; | ||
printMetadata($im); | ||
|
||
echo "\nafter keep => icc\n"; | ||
$buf = $im->tiffsave_buffer(['keep' => Vips\ForeignKeep::ICC]); | ||
$im2 = Vips\Image::newFromBuffer($buf, ""); | ||
printMetadata($im2); | ||
|
||
echo "\nafter keep => exif|xmp\n"; | ||
$buf = $im->tiffsave_buffer(['keep' => Vips\ForeignKeep::ICC | Vips\ForeignKeep::XMP]); | ||
$im2 = Vips\Image::newFromBuffer($buf, ""); | ||
printMetadata($im2); | ||
|
||
/* | ||
* Local variables: | ||
* tab-width: 4 | ||
* c-basic-offset: 4 | ||
* End: | ||
* vim600: expandtab sw=4 ts=4 fdm=marker | ||
* vim<600: expandtab sw=4 ts=4 | ||
*/ |
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 |
---|---|---|
|
@@ -39,22 +39,21 @@ | |
namespace Jcupitt\Vips; | ||
|
||
/** | ||
* The ImageType enum. | ||
* The ForeignKeep flags. | ||
* @category Images | ||
* @package Jcupitt\Vips | ||
* @author John Cupitt <[email protected]> | ||
* @copyright 2016 John Cupitt | ||
* @license https://opensource.org/licenses/MIT MIT | ||
* @link https://github.com/jcupitt/php-vips | ||
*/ | ||
abstract class ImageType | ||
abstract class ForeignKeep | ||
{ | ||
const ERROR = 'error'; | ||
const NONE = 'none'; | ||
const SETBUF = 'setbuf'; | ||
const SETBUF_FOREIGN = 'setbuf-foreign'; | ||
const OPENIN = 'openin'; | ||
const MMAPIN = 'mmapin'; | ||
const MMAPINRW = 'mmapinrw'; | ||
const OPENOUT = 'openout'; | ||
const NONE = 0; | ||
const EXIF = 1; | ||
const XMP = 2; | ||
const IPTC = 4; | ||
const ICC = 8; | ||
const OTHER = 16; | ||
const ALL = 31; | ||
} |
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 |
---|---|---|
|
@@ -39,18 +39,20 @@ | |
namespace Jcupitt\Vips; | ||
|
||
/** | ||
* The Token enum. | ||
* The ForeignPngFilter flags. | ||
* @category Images | ||
* @package Jcupitt\Vips | ||
* @author John Cupitt <[email protected]> | ||
* @copyright 2016 John Cupitt | ||
* @license https://opensource.org/licenses/MIT MIT | ||
* @link https://github.com/jcupitt/php-vips | ||
*/ | ||
abstract class Token | ||
abstract class ForeignPngFilter | ||
{ | ||
const LEFT = 'left'; | ||
const RIGHT = 'right'; | ||
const STRING = 'string'; | ||
const EQUALS = 'equals'; | ||
const NONE = 8; | ||
const SUB = 16; | ||
const UP = 32; | ||
const AVG = 64; | ||
const PAETH = 128; | ||
const ALL = 248; | ||
} |
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