PHP Class PHPExiftool\Writer

Example usage : $Writer = new Writer(); $metadatas = new MetadataBag(); $metadata->add(new Metadata(new IPTC\ObjectName(), Value\Mono('Super title !'))); writes the metadatas to the file $Writer->writes('image.jpg', $metadatas); writes the metadatas to image_copied.jpg $Writer->writes('image.jpg', $metadatas, 'image_copied.jpg');
ファイルを表示 Open project: romainneutron/PHPExiftool Class Usage Examples

Protected Properties

Property Type Description
$erase
$mode
$modules

Public Methods

Method Description
__construct ( Exiftool $exiftool )
create ( Psr\Log\LoggerInterface $logger ) : Writer Factory for standard Writer
erase ( boolean $boolean, boolean $maintainICCProfile = false ) If set to true, erase all metadatas before write
hasModule ( integer $module ) : boolean Return true if the module is enabled
isMode ( integer $mode ) : boolean Return true if the mode is enabled
reset ( )
setMode ( integer $mode, boolean $active ) : Writer Enable / Disable modes
setModule ( integer $module, boolean $active ) : Writer Enable / disable module.
write ( string $file, MetadataBag $metadatas, string $destination = null ) : integer Writes metadatas to the file. If a destination is provided, original file is not modified.

Protected Methods

Method Description
addMetadatasArg ( MetadataBag $metadatas ) : string Computes modes, modules and metadatas to a single commandline
getSyncCommand ( )

Method Details

__construct() public method

public __construct ( Exiftool $exiftool )
$exiftool Exiftool

addMetadatasArg() protected method

Computes modes, modules and metadatas to a single commandline
protected addMetadatasArg ( MetadataBag $metadatas ) : string
$metadatas PHPExiftool\Driver\Metadata\MetadataBag A Bag of metadatas
return string A part of the command

create() public static method

Factory for standard Writer
public static create ( Psr\Log\LoggerInterface $logger ) : Writer
$logger Psr\Log\LoggerInterface
return Writer

erase() public method

If set to true, erase all metadatas before write
public erase ( boolean $boolean, boolean $maintainICCProfile = false )
$boolean boolean Whether to erase metadata or not before writing.
$maintainICCProfile boolean Whether to maintain or not ICC Profile in case of erasing metadata.

getSyncCommand() protected method

protected getSyncCommand ( )

hasModule() public method

Return true if the module is enabled
public hasModule ( integer $module ) : boolean
$module integer
return boolean

isMode() public method

Return true if the mode is enabled
public isMode ( integer $mode ) : boolean
$mode integer One of the self::MODE_*
return boolean True if the mode is enabled

reset() public method

public reset ( )

setMode() public method

Enable / Disable modes
public setMode ( integer $mode, boolean $active ) : Writer
$mode integer One of the self::MODE_*
$active boolean Enable or disable the mode
return Writer

setModule() public method

There's currently only one module self::MODULE_MWG
public setModule ( integer $module, boolean $active ) : Writer
$module integer One of the self::MODULE_*
$active boolean Enable or disable the module
return Writer

write() public method

Writes metadatas to the file. If a destination is provided, original file is not modified.
public write ( string $file, MetadataBag $metadatas, string $destination = null ) : integer
$file string The input file
$metadatas PHPExiftool\Driver\Metadata\MetadataBag A bag of metadatas
$destination string The output file
return integer the number of file written

Property Details

$erase protected_oe property

protected $erase

$mode protected_oe property

protected $mode

$modules protected_oe property

protected $modules