Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96451e7

Browse filesBrowse files
committed
Integrate new Image Component
1 parent 916aff8 commit 96451e7
Copy full SHA for 96451e7

File tree

Expand file treeCollapse file tree

115 files changed

+1084
-835
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

115 files changed

+1084
-835
lines changed

‎.github/gmagick.sh

Copy file name to clipboard
+61Lines 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

Copy file name to clipboard
+51Lines 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

Copy file name to clipboardExpand all lines: .travis.yml
+11-1Lines 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
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

Copy file name to clipboardExpand all lines: appveyor.yml
+2Lines 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

Copy file name to clipboardExpand all lines: composer.json
+1Lines 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",
+3Lines 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/
+7Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Image/Filter/Basic/WebOptimization.php
+13-4Lines 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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Image/Filter/FilterInterface.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Image/Filter/LoaderAware.php
+1-1Lines 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
{

‎src/Symfony/Component/Image/Filter/Transformation.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Image/Filter/Transformation.php
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
use Symfony\Component\Image\Image\PointInterface;
3535

3636
/**
37-
* A transformation filter
37+
* A transformation filter.
3838
*/
3939
final class Transformation implements FilterInterface, ManipulatorInterface
4040
{
@@ -67,12 +67,13 @@ public function __construct(LoaderInterface $loader = null)
6767

6868
/**
6969
* Applies a given FilterInterface onto given ImageInterface and returns
70-
* modified ImageInterface
70+
* modified ImageInterface.
7171
*
7272
* @param ImageInterface $image
7373
* @param FilterInterface $filter
7474
*
7575
* @return ImageInterface
76+
*
7677
* @throws InvalidArgumentException
7778
*/
7879
public function applyFilter(ImageInterface $image, FilterInterface $filter)
@@ -224,10 +225,11 @@ public function thumbnail(BoxInterface $size, $mode = ImageInterface::THUMBNAIL_
224225

225226
/**
226227
* Registers a given FilterInterface in an internal array of filters for
227-
* later application to an instance of ImageInterface
228+
* later application to an instance of ImageInterface.
229+
*
230+
* @param FilterInterface $filter
231+
* @param int $priority
228232
*
229-
* @param FilterInterface $filter
230-
* @param int $priority
231233
* @return Transformation
232234
*/
233235
public function add(FilterInterface $filter, $priority = 0)

‎src/Symfony/Component/Image/Gd/Drawer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Image/Gd/Drawer.php
+11-15Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
use Symfony\Component\Image\Image\PointInterface;
2222

2323
/**
24-
* Drawer implementation using the GD library
24+
* Drawer implementation using the GD library.
2525
*/
2626
final class Drawer implements DrawerInterface
2727
{
@@ -36,7 +36,7 @@ final class Drawer implements DrawerInterface
3636
private $info;
3737

3838
/**
39-
* Constructs Drawer with a given gd image resource
39+
* Constructs Drawer with a given gd image resource.
4040
*
4141
* @param resource $resource
4242
*/
@@ -70,7 +70,7 @@ public function arc(PointInterface $center, BoxInterface $size, $start, $end, Co
7070
}
7171

7272
/**
73-
* This function does not work properly because of a bug in GD
73+
* This function does not work properly because of a bug in GD.
7474
*
7575
* {@inheritdoc}
7676
*/
@@ -248,11 +248,11 @@ public function text($string, AbstractFont $font, PointInterface $position, $ang
248248
throw new RuntimeException('GD is not compiled with FreeType support');
249249
}
250250

251-
$angle = -1 * $angle;
251+
$angle = -1 * $angle;
252252
$fontsize = $font->getSize();
253253
$fontfile = $font->getFile();
254-
$x = $position->getX();
255-
$y = $position->getY() + $fontsize;
254+
$x = $position->getX();
255+
$y = $position->getY() + $fontsize;
256256

257257
if ($width !== null) {
258258
$string = $this->wrapText($string, $font, $angle, $width);
@@ -275,9 +275,7 @@ public function text($string, AbstractFont $font, PointInterface $position, $ang
275275
}
276276

277277
/**
278-
* Internal
279-
*
280-
* Generates a GD color from Color instance
278+
* Generates a GD color from Color instance.
281279
*
282280
* @param ColorInterface $color
283281
*
@@ -310,21 +308,19 @@ private function loadGdInfo()
310308
}
311309

312310
/**
313-
* Internal
314-
*
315-
* Fits a string into box with given width
311+
* Fits a string into box with given width.
316312
*/
317313
private function wrapText($string, AbstractFont $font, $angle, $width)
318314
{
319315
$result = '';
320316
$words = explode(' ', $string);
321317
foreach ($words as $word) {
322-
$teststring = $result . ' ' . $word;
318+
$teststring = $result.' '.$word;
323319
$testbox = imagettfbbox($font->getSize(), $angle, $font->getFile(), $teststring);
324320
if ($testbox[2] > $width) {
325-
$result .= ($result == '' ? '' : "\n") . $word;
321+
$result .= ($result == '' ? '' : "\n").$word;
326322
} else {
327-
$result .= ($result == '' ? '' : ' ') . $word;
323+
$result .= ($result == '' ? '' : ' ').$word;
328324
}
329325
}
330326

‎src/Symfony/Component/Image/Gd/Effects.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Image/Gd/Effects.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Symfony\Component\Image\Image\Palette\Color\RGB as RGBColor;
1818

1919
/**
20-
* Effects implementation using the GD library
20+
* Effects implementation using the GD library.
2121
*/
2222
class Effects implements EffectsInterface
2323
{
@@ -46,7 +46,7 @@ public function gamma($correction)
4646
public function negative()
4747
{
4848
if (false === imagefilter($this->resource, IMG_FILTER_NEGATE)) {
49-
throw new RuntimeException('Failed to negate the image');
49+
throw new RuntimeException('Failed to negate the image');
5050
}
5151

5252
return $this;
@@ -58,7 +58,7 @@ public function negative()
5858
public function grayscale()
5959
{
6060
if (false === imagefilter($this->resource, IMG_FILTER_GRAYSCALE)) {
61-
throw new RuntimeException('Failed to grayscale the image');
61+
throw new RuntimeException('Failed to grayscale the image');
6262
}
6363

6464
return $this;
@@ -85,7 +85,7 @@ public function colorize(ColorInterface $color)
8585
*/
8686
public function sharpen()
8787
{
88-
$sharpenMatrix = array(array(-1,-1,-1), array(-1,16,-1), array(-1,-1,-1));
88+
$sharpenMatrix = array(array(-1, -1, -1), array(-1, 16, -1), array(-1, -1, -1));
8989
$divisor = array_sum(array_map('array_sum', $sharpenMatrix));
9090

9191
if (false === imageconvolution($this->resource, $sharpenMatrix, $divisor, 0)) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.