8000 Integrate new Image Component · romainneutron/symfony@a80d5f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit a80d5f0

Browse files
committed
Integrate new Image Component
1 parent 916aff8 commit a80d5f0

File tree

115 files changed

+1157
-933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1157
-933
lines changed

.github/gmagick.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
set -xe
4+
5+
if [ -z "$1" ]
6+
then
7+
echo "You must provide the PHP version as first argument"
8+
exit 1
9+
fi
10+
11+
if [ -z "$2" ]
12+
then
13+
echo "You must provide the php.ini path as second argument"
14+
exit 1
15+
fi
16+
17+
PHP_VERSION=$1
18+
PHP_INI_FILE=$2
19+
20+
GRAPHICSMAGIC_VERSION="1.3.23"
21+
if [ $PHP_VERSION = '7.0' ] || [ $PHP_VERSION = '7.1' ]
22+
then
23+
GMAGICK_VERSION="2.0.4RC1"
24+
else
25+
GMAGICK_VERSION="1.1.7RC2"
26+
fi
27+
28+
mkdir -p cache
29+
cd cache
30+
31+
if [ ! -e ./GraphicsMagick-$GRAPHICSMAGIC_VERSION ]
32+
then
33+
wget http://78.108.103.11/MIRROR/ftp/GraphicsMagick/1.3/GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz
34+
tar -xf GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz
35+
rm GraphicsMagick-$GRAPHICSMAGIC_VERSION.tar.xz
36+
cd GraphicsMagick-$GRAPHICSMAGIC_VERSION
37+
./configure --prefix=$HOME/opt/gmagick --enable-shared --with-lcms2
38+
make -j
39+
else
40+
cd GraphicsMagick-$GRAPHICSMAGIC_VERSION
41+
fi
42+
43+
make install
44+
cd ..
45+
46+
if [ ! -e ./gmagick-$GMAGICK_VERSION ]
47+
then
48+
wget https://pecl.php.net/get/gmagick-$GMAGICK_VERSION.tgz
49+
tar -xzf gmagick-$GMAGICK_VERSION.tgz
50+
rm gmagick-$GMAGICK_VERSION.tgz
51+
cd gmagick-$GMAGICK_VERSION
52+
phpize
53+
./configure --with-gmagick=$HOME/opt/gmagick
54+
make -j
55+
else
56+
cd gmagick-$GMAGICK_VERSION
57+
fi
58+
59+
make install
60+
echo "extension=`pwd`/modules/gmagick.so" >> $PHP_INI_FILE
61+
php --ri gmagick

.github/imagick.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
set -xe
4+
5+
if [ -z "$1" ]
6+
then
7+
echo "You must provide the php.ini path as first argument"
8+
exit 1
9+
fi
10+
11+
PHP_INI_FILE=$1
12+
13+
IMAGEMAGICK_VERSION="6.8.9-10"
14+
IMAGICK_VERSION="3.4.3"
15+
16+
mkdir -p cache
17+
cd cache
18+
19+
if [ ! -e ./ImageMagick-$IMAGEMAGICK_VERSION ]
20+
then
21+
wget https://www.imagemagick.org/download/releases/ImageMagick-$IMAGEMAGICK_VERSION.tar.xz
22+
tar -xf ImageMagick-$IMAGEMAGICK_VERSION.tar.xz
23+
rm ImageMagick-$IMAGEMAGICK_VERSION.tar.xz
24+
cd ImageMagick-$IMAGEMAGICK_VERSION
25+
./configure --prefix=$HOME/opt/imagemagick
26+
make -j
27+
else
28+
cd ImageMagick-$IMAGEMAGICK_VERSION
29+
fi
30+
31+
make install
32+
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$HOME/opt/imagemagick/lib/pkgconfig
33+
ln -s $HOME/opt/imagemagick/include/ImageMagick-6 $HOME/opt/imagemagick/include/ImageMagick
34+
cd ..
35+
36+
if [ ! -e ./imagick-$IMAGICK_VERSION ]
37+
then
38+
wget https://pecl.php.net/get/imagick-$IMAGICK_VERSION.tgz
39+
tar -xzf imagick-$IMAGICK_VERSION.tgz
40+
rm imagick-$IMAGICK_VERSION.tgz
41+
cd imagick-$IMAGICK_VERSION
42+
phpize
43+
./configure --with-imagick=$HOME/opt/imagemagick
44+
make -j
45+
else
46+
cd imagick-$IMAGICK_VERSION
47+
fi
48+
49+
make install
50+
echo "extension=`pwd`/modules/imagick.so" >> $PHP_INI_FILE
51+
php --ri imagick

.travis.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ addons:
1111
- language-pack-fr-base
1212
- ldap-utils
1313
- slapd
14+
- libtiff-dev
15+
- libjpeg-dev
16+
- libdjvulibre-dev
17+
- libwmf-dev
18+
- pkg-config
19+
- liblcms2-dev
1420

1521
env:
1622
global:
@@ -26,16 +32,18 @@ matrix:
2632
group: edge
2733
- php: 5.5
2834
- php: 5.6
35+
env: IMAGE_DRIVER=gmagick
2936
- php: 7.0
3037
env: deps=high
3138
- php: 7.1
32-
env: deps=low
39+
env: deps=low IMAGE_DRIVER=imagick
3340
fast_finish: true
3441

3542
cache:
3643
directories:
3744
- .phpunit
3845
- php-$MIN_PHP
46+
- cache
3947

4048
services:
4149
- memcached
@@ -90,6 +98,8 @@ install:
9098
- if [[ ! $skip ]]; then composer update; fi
9199
- if [[ ! $skip ]]; then ./phpunit install; fi
92100
- if [[ ! $skip && ! $PHP = hhvm* ]]; then php -i; else hhvm --php -r 'print_r($_SERVER);print_r(ini_get_all());'; fi
101+
- if [[ $IMAGE_DRIVER = imagick ]]; then ./.github/imagick.sh $INI_FILE; fi
< 10000 /td>102+
- if [[ $IMAGE_DRIVER = gmagick ]]; then ./.github/gmagick.sh $TRAVIS_PHP_VERSION $INI_FILE; fi
93103

94104
script:
95105
- REPORT=' && echo -e "\\e[32mOK\\e[0m {}\\n\\n" || (echo -e "\\e[41mKO\\e[0m {}\\n\\n" && $(exit 1))'

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ install:
3939
- echo apc.enable_cli=1 >> php.ini-max
4040
- echo extension=php_memcache.dll >> php.ini-max
4141
- echo extension=php_intl.dll >> php.ini-max
42+
- echo extension=php_exif.dll >> php.ini-max
43+
- echo extension=php_gd2.dll >> php.ini-max
4244
- echo extension=php_mbstring.dll >> php.ini-max
4345
- echo extension=php_fileinfo.dll >> php.ini-max
4446
- echo extension=php_pdo_sqlite.dll >> php.ini-max

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"ocramius/proxy-manager": "~0.4|~1.0|~2.0",
9393
"predis/predis": "~1.0",
9494
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
95+
"symfony/image-fixtures": "dev-master@dev",
9596
"symfony/phpunit-bridge": "~3.2",
9697
"symfony/polyfill-apcu": "~1.1",
9798
"symfony/security-acl": "~2.8|~3.0",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
composer.lock
2+
phpunit.xml
3+
vendor/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG
2+
=========
3+
4+
3.3.0
5+
-----
6+
7+
* [EXPERIMENTAL] added the component

src/Symfony/Component/Image/Filter/Basic/WebOptimization.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Symfony\Component\Image\Filter\FilterInterface;
1717

1818
/**
19-
* A filter to render web-optimized images
19+
* A filter to render web-optimized images.
2020
*/
2121
class WebOptimization implements FilterInterface
2222
{
@@ -28,10 +28,19 @@ public function __construct($path = null, array $options = array())
2828
{
2929
$this->path = $path;
3030
$this->options = array_replace(array(
31-
'resolution-units' => ImageInterface::RESOLUTION_PIXELSPERINCH,
32-
'resolution-y' => 72,
33-
'resolution-x' => 72,
31+
'resolution_units' => ImageInterface::RESOLUTION_PIXELSPERINCH,
32+
'resolution_y' => 72,
33+
'resolution_x' => 72,
3434
), $options);
35+
36+
foreach (array('resolution-x', 'resolution-y', 'resolution-units') as $option) {
37+
if (isset($this->options[$option])) {
38+
@trigger_error(sprintf('"%s" as been deprecated in Symfony 3.3 in favor of "%"', $option, str_replace('-', '_', $option)), E_USER_DEPRECATED);
39+
$this->options[str_replace('-', '_', $option)] = $this->options[$option];
40+
unset($this->options[$option]);
41+
}
42+
}
43+
3544
$this->palette = new RGB();
3645
}
3746

src/Symfony/Component/Image/Filter/FilterInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
1414
use Symfony\Component\Image\Image\ImageInterface;
1515

1616
/**
17-
* Interface for filters
17+
* Interface for filters.
1818
*/
1919
interface FilterInterface
2020
{
2121
/**
2222
* Applies scheduled transformation to ImageInterface instance
23-
* Returns processed ImageInterface instance
23+
* Returns processed ImageInterface instance.
2424
*
2525
* @param ImageInterface $image
2626
*

src/Symfony/Component/Image/Filter/LoaderAware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Image\Image\LoaderInterface;
1616

1717
/**
18-
* LoaderAware base class
18+
* LoaderAware base class.
1919
*/
2020
abstract class LoaderAware implements FilterInterface
2121
{

0 commit comments

Comments
 (0)
0