Adding title, width & height and updating README

This commit is contained in:
Grégoire Passault 2011-08-26 08:59:29 +02:00
parent e9e2cf5179
commit 49cb96b534
3 changed files with 15 additions and 1 deletions

View File

@ -22,6 +22,7 @@ class CaptchaGenerator {
public function generate() public function generate()
{ {
$i = imagecreatetruecolor(120,40); $i = imagecreatetruecolor(120,40);
$col = imagecolorallocate($i, mt_rand(0,110), mt_rand(0,110), mt_rand(0,110)); $col = imagecolorallocate($i, mt_rand(0,110), mt_rand(0,110), mt_rand(0,110));
imagefill($i, 0, 0, 0xFFFFFF); imagefill($i, 0, 0, 0xFFFFFF);

View File

@ -56,6 +56,19 @@ You can use the "captcha" type in your forms this way:
Note that the generated image will be embeded in the HTML document, to avoid dealing Note that the generated image will be embeded in the HTML document, to avoid dealing
with route and subrequests. with route and subrequests.
Form theming
============
If you want to put the image in an other way, you can form theme `captcha_bundle` (this
is the default behavior) :
```html
{% block captcha_widget %}
<img src="{{ captcha_code }}" title="captcha" width="120" height="40" />
{{ form_widget(form) }}
{% endblock %}
```
License License
======= =======

View File

@ -1,4 +1,4 @@
{% block captcha_widget %} {% block captcha_widget %}
<img src="{{ captcha_code }}" /><br /> <img src="{{ captcha_code }}" title="captcha" width="120" height="40" />
{{ form_widget(form) }} {{ form_widget(form) }}
{% endblock %} {% endblock %}