This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/tests/Symfony
Fabien Potencier f75d8ff653 merged branch benjamindulau/ImageValidator (PR #1214)
Commits
-------

89f4791 Fixed CS
a348efe Removed trailing whitespaces
135531a Replaced setExpectedException() methods by annotations
6ad83e7 Updated according to PR review
2de243c * Added Fixtures 2x2px test.gif image file * Updated tests for using fixture image instead of imagecreate function
a5a2dfa [ImageValidator] Added dedicated ImageValidator class with min width, max width, min height and max height validations

Discussion
----------

[2.1] [ImageValidator] Improved ImageValidator + tests

Added dedicated ImageValidator class with min width, max width, min height and max height validations

---------------------------------------------------------------------------

by kriswallsmith at 2011/06/04 10:32:56 -0700

This is nice but doesn't belong in the core as it adds a dependency on GD.

---------------------------------------------------------------------------

by benjamindulau at 2011/06/04 10:41:02 -0700

@kriswallsmith i'm not sure, php.net doc says :

    Note:

    This function does not require the GD image library.

Well, that could also be a mistake :)

---------------------------------------------------------------------------

by pborreli at 2011/06/04 11:17:25 -0700

i think @benjamindulau is right

```
$ php -m
[PHP Modules]
bcmath
calendar
com_dotnet
Core
ctype
date
dom
ereg
filter
ftp
hash
iconv
json
libxml
mcrypt
mhash
mysqlnd
odbc
pcre
PDO
Phar
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
wddx
xdebug
xml
xmlreader
xmlwriter
zip
zlib
```

```
$ php -r "var_dump(getimagesize(__DIR__.'/src/Symfony/Bundle/FrameworkBund
le/Resources/public/images/blue_picto_less.gif'));"
array(7) {
  [0]=>
  int(18)
  [1]=>
  int(18)
  [2]=>
  int(1)
  [3]=>
  string(22) "width="18" height="18""
  ["bits"]=>
  int(5)
  ["channels"]=>
  int(3)
  ["mime"]=>
  string(9) "image/gif"
}
```

---------------------------------------------------------------------------

by benjamindulau at 2011/06/04 11:22:57 -0700

However, the tests use imagejpeg and imagedestroy, that's not valid.
But, i'm not sure how to correctly test the validator then.

---------------------------------------------------------------------------

by benjamindulau at 2011/06/04 11:31:51 -0700

Can i use an image from FrameworkBundle resources ?

---------------------------------------------------------------------------

by pborreli at 2011/06/06 03:47:24 -0700

just add your own image inside Fixture folder (smaller the better, 1x1, 1x2 ..)

---------------------------------------------------------------------------

by stof at 2011/09/04 05:27:42 -0700

@benjamindulau could you rebase your PR and update it according to the comments ?

---------------------------------------------------------------------------

by benjamindulau at 2011/09/04 06:31:34 -0700

Yep, i think i can find some time today to do that

---------------------------------------------------------------------------

by benjamindulau at 2011/09/04 09:27:29 -0700

I've updated the PR.

A big thank to Stof who helped me with my git mess ;-)
2011-09-06 08:18:07 +02:00
..
Tests merged branch benjamindulau/ImageValidator (PR #1214) 2011-09-06 08:18:07 +02:00