Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed

  • Loading branch information...
commit 254927f0dce4c67b31e13c3f15e886244c1db973 1 parent feb8119
@genemu authored
View
1  Form/Core/Type/CaptchaType.php
@@ -15,7 +15,6 @@
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\FormInterface;
-use Symfony\Component\HttpFoundation\Session;
use Genemu\Bundle\FormBundle\Gd\Type\Captcha;
use Genemu\Bundle\FormBundle\Form\Core\Validator\CaptchaValidator;
View
22 Form/JQuery/Type/ColorType.php
@@ -28,7 +28,9 @@ class ColorType extends AbstractType
*/
public function buildForm(FormBuilder $builder, array $options)
{
- $builder->setAttribute('configs', $options['configs']);
+ $builder
+ ->setAttribute('widget', $options['widget'])
+ ->setAttribute('configs', $options['configs']);
}
/**
@@ -37,7 +39,9 @@ public function buildForm(FormBuilder $builder, array $options)
public function buildView(FormView $view, FormInterface $form)
{
- $view->set('configs', $form->getAttribute('configs'));
+ $view
+ ->set('widget', $form->getAttribute('widget'))
+ ->set('configs', $form->getAttribute('configs'));
}
/**
@@ -46,6 +50,7 @@ public function buildView(FormView $view, FormInterface $form)
public function getDefaultOptions(array $options)
{
$defaultOptions = array(
+ 'widget' => 'field',
'configs' => array(),
);
@@ -55,6 +60,19 @@ public function getDefaultOptions(array $options)
/**
* {@inheritdoc}
*/
+ public function getAllowedOptionValues(array $options)
+ {
+ return array(
+ 'widget' => array(
+ 'field',
+ 'image',
+ )
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function getParent(array $options)
{
return 'field';
View
4 Gd/File/Image.php
@@ -37,12 +37,12 @@ public function __construct($path, $checkPath = true)
{
parent::__construct($path, $checkPath);
- if (!preg_match('/image/', $this->getMimeType())) {
+ if (false !== strpos($this->getMimeType(), 'image')) {

I am currently in the process of trying to make the image upload crop feature to work.
As trying to understand what is going wrong, it seems that
if (false !== strpos($this->getMimeType(), 'image')) {
is wrong.
We could put instead
if (0 !== strpos($this->getMimeType(), 'image')) {
OR
if (false != strpos($this->getMimeType(), 'image')) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
throw new \Exception('Is not a image file.');
}
$format = $this->checkFormat($this->guessExtension());
- $generate = 'imagecreatefrom'.$format;
+ $generate = 'imagecreatefrom' . $format;
$this->gd = new Gd();
$this->gd->setResource($generate($this->getPathname()));
View
2  Twig/Extension/FormExtension.php
@@ -14,8 +14,6 @@
use Symfony\Bridge\Twig\Extension\FormExtension as BaseFormExtension;
use Symfony\Component\Form\FormView;
-use Assetic\Asset\StringAsset;
-
/**
* FormExtension extends Twig with form capabilities.
*
Please sign in to comment.
Something went wrong with that request. Please try again.