Feature #20041 ยป typo3core_feature_10471_v2.patch
t3lib/class.t3lib_stdgraphic.php (copie de travail) | ||
---|---|---|
* @param string The relative (to PATH_site) image filepath, the mask file (grayscale)
|
||
* @param string The relative (to PATH_site) image filepath, output filename (written to)
|
||
* @param [type] $handleNegation: ...
|
||
* @param string $additionalParameters: an array of ImageMagick options, eg array('geometry' => '100x12')
|
||
* @return void
|
||
*/
|
||
function combineExec($input,$overlay,$mask,$output, $handleNegation = false) {
|
||
function combineExec($input,$overlay,$mask,$output, $handleNegation = false, $additionalParameters = array()) {
|
||
if (!$this->NO_IMAGE_MAGICK) {
|
||
$params = '-colorspace GRAY +matte';
|
||
if ($handleNegation) {
|
||
if ($this->maskNegate) {
|
||
$params .= ' '.$this->maskNegate;
|
||
$combineParameters = '';
|
||
// +matte = no alpha layer in output
|
||
$parameters = array('matte' => TRUE);
|
||
$parameters = array_merge($parameters, $additionalParameters);
|
||
foreach ($parameters as $parameter => $value) {
|
||
$combineParameters .= ' ' . (($value === TRUE) ? '+' : '-') . $parameter . (($value === TRUE || $value === FALSE) ? '' : ' ' . $value);
|
||
}
|
||
$maskParameters = '-colorspace GRAY +matte';
|
||
if ($handleNegation) {
|
||
if ($this->maskNegate) {
|
||
$maskParameters .= ' '.$this->maskNegate;
|
||
}
|
||
}
|
||
$theMask = $this->randomName().'.'.$this->gifExtension;
|
||
$this->imageMagickExec($mask, $theMask, $params);
|
||
$cmd = t3lib_div::imageMagickCommand('combine', '-compose over +matte '.$this->wrapFileName($input).' '.$this->wrapFileName($overlay).' '.$this->wrapFileName($theMask).' '.$this->wrapFileName($output)); // +matte = no alpha layer in output
|
||
$this->imageMagickExec($mask, $theMask, $maskParameters);
|
||
$cmd = t3lib_div::imageMagickCommand('combine', '-compose over' . $combineParameters . ' ' . $this->wrapFileName($input).' '.$this->wrapFileName($overlay).' '.$this->wrapFileName($theMask).' '.$this->wrapFileName($output));
|
||
$this->IM_commands[] = Array ($output,$cmd);
|
||
$ret = exec($cmd);
|
||
t3lib_div::fixPermissions($this->wrapFileName($output)); // Change the permissions of the file
|
||
if (is_file($theMask)) {
|
||
// Change the permissions of the file
|
||
t3lib_div::fixPermissions($this->wrapFileName($output));
|
||
if (is_file($theMask)) {
|
||
@unlink($theMask);
|
||
}
|
||