PHRAS-152 #fix Add flatten option to disable transparancy

This commit is contained in:
Nicolas Le Goff
2014-07-07 20:03:53 +02:00
parent f0f4b3b0e1
commit cbae125fc2
4 changed files with 32 additions and 14 deletions

View File

@@ -21,6 +21,10 @@
{
"type": "vcs",
"url": "https://github.com/nlegoff/Media-Alchemyst"
},
{
"type": "vcs",
"url": "https://github.com/nlegoff/Imagine"
}
],
"minimum-stability" : "dev",
@@ -37,7 +41,7 @@
"alchemy/geonames-api-consumer" : "~0.1.0",
"goodby/csv" : "~1.0",
"guzzle/guzzle" : "~3.0",
"imagine/imagine" : "0.6.x-dev@dev",
"imagine/imagine" : "dev-flatten-layer as 0.6.1",
"jms/serializer" : "~0.10",
"justinrainbow/json-schema" : "~1.3",
"mediavorus/mediavorus" : "dev-fix-video-dim as 0.4.3",

34
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "750b57fb39506c69b9f7c63097f9160b",
"hash": "748dacbcdc2199ab5eed1a237bf4fd17",
"packages": [
{
"name": "alchemy-fr/tcpdf-clone",
@@ -1214,16 +1214,16 @@
},
{
"name": "imagine/imagine",
"version": "dev-develop",
"version": "dev-flatten-layer",
"source": {
"type": "git",
"url": "https://github.com/avalanche123/Imagine.git",
"reference": "237ccf205dd5ece7a00a574b4f18bd118aa08a5d"
"url": "https://github.com/nlegoff/Imagine.git",
"reference": "df2d9d8834d32943082fc52b89c5b11fde279b5a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/avalanche123/Imagine/zipball/237ccf205dd5ece7a00a574b4f18bd118aa08a5d",
"reference": "237ccf205dd5ece7a00a574b4f18bd118aa08a5d",
"url": "https://api.github.com/repos/nlegoff/Imagine/zipball/df2d9d8834d32943082fc52b89c5b11fde279b5a",
"reference": "df2d9d8834d32943082fc52b89c5b11fde279b5a",
"shasum": ""
},
"require": {
@@ -1240,7 +1240,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.6-dev"
"dev-develop": "0.7-dev"
}
},
"autoload": {
@@ -1248,7 +1248,6 @@
"Imagine": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -1267,7 +1266,10 @@
"image manipulation",
"image processing"
],
"time": "2013-10-26 10:53:02"
"support": {
"source": "https://github.com/nlegoff/Imagine/tree/flatten-layer"
},
"time": "2014-07-07 17:04:15"
},
{
"name": "jms/metadata",
@@ -1496,12 +1498,12 @@
"source": {
"type": "git",
"url": "https://github.com/nlegoff/Media-Alchemyst.git",
"reference": "e812e631b74ebb0c7b3dd5f4e981d84a7b3c4029"
"reference": "be5c7cd4e207c469fb88d88397bd220c4db323d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nlegoff/Media-Alchemyst/zipball/e812e631b74ebb0c7b3dd5f4e981d84a7b3c4029",
"reference": "e812e631b74ebb0c7b3dd5f4e981d84a7b3c4029",
"url": "https://api.github.com/repos/nlegoff/Media-Alchemyst/zipball/be5c7cd4e207c469fb88d88397bd220c4db323d8",
"reference": "be5c7cd4e207c469fb88d88397bd220c4db323d8",
"shasum": ""
},
"require": {
@@ -1563,7 +1565,7 @@
"support": {
"source": "https://github.com/nlegoff/Media-Alchemyst/tree/master"
},
"time": "2014-06-10 13:51:13"
"time": "2014-07-07 16:54:32"
},
{
"name": "mediavorus/mediavorus",
@@ -4014,6 +4016,12 @@
}
],
"aliases": [
{
"alias": "0.6.1",
"alias_normalized": "0.6.1.0",
"version": "dev-flatten-layer",
"package": "imagine/imagine"
},
{
"alias": "0.4.3",
"alias_normalized": "0.4.3.0",

View File

@@ -25,6 +25,7 @@ class Image extends Provider
const OPTION_RESOLUTION = 'resolution';
const OPTION_STRIP = 'strip';
const OPTION_QUALITY = 'quality';
const OPTION_FLATTEN = 'flatten';
protected $options = array();
@@ -33,6 +34,7 @@ class Image extends Provider
$this->registerOption(new OptionType\Range(_('Dimension'), self::OPTION_SIZE, 20, 3000, 800));
$this->registerOption(new OptionType\Range(_('Resolution'), self::OPTION_RESOLUTION, 50, 300, 72));
$this->registerOption(new OptionType\Boolean(_('Remove ICC Profile'), self::OPTION_STRIP, false));
$this->registerOption(new OptionType\Boolean(_('Flatten layers'), self::OPTION_FLATTEN, false));
$this->registerOption(new OptionType\Range(_('Quality'), self::OPTION_QUALITY, 0, 100, 75));
}
@@ -59,6 +61,7 @@ class Image extends Provider
$this->spec->setDimensions($size, $size);
$this->spec->setQuality($this->getOption(self::OPTION_QUALITY)->getValue());
$this->spec->setStrip($this->getOption(self::OPTION_STRIP)->getValue());
$this->spec->setFlatten($this->getOption(self::OPTION_FLATTEN)->getValue());
$this->spec->setResolution($resolution, $resolution);
return $this->spec;

View File

@@ -305,6 +305,9 @@ class databox_subdef
if ($sd->dpi) {
$image->setOptionValue(Image::OPTION_RESOLUTION, (int) $sd->dpi);
}
if ($sd->flatten) {
$image->setOptionValue(Image::OPTION_FLATTEN, p4field::isyes($sd->flatten));
}
return $image;
}