Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help. I can not make it work. Not appear the button to add image. #76

Closed
yumoraes opened this issue Jun 20, 2016 · 5 comments
Closed

help. I can not make it work. Not appear the button to add image. #76

yumoraes opened this issue Jun 20, 2016 · 5 comments

Comments

@yumoraes
Copy link

My code:
Controler:
` /**
* @route("/pacote/novoPacote", name="friendstrip.app.pacotes.novoPacote")
* @template("FriendstripAppBundle:Pacotes:novoPacote.html.twig");
*/
public function novoPacoteAction(Request $request)
{
$pacote = new AppBundle\Entity\Pacote();

    $form = $this->createFormBuilder($pacote)
         ->add('image', 'comur_image', array(
            'uploadConfig' => array(
                'uploadRoute' => 'comur_api_upload',        //optional
                'uploadUrl' => $pacote->getUploadRootDir(),       // required - see explanation below (you can also put just a dir path)
                'webDir' => $pacote->getUploadDir(),              // required - see explanation below (you can also put just a dir path)
                'fileExt' => '*.jpg;*.gif;*.png;*.jpeg',    //optional
                'libraryDir' => null,                       //optional
                'libraryRoute' => 'comur_api_image_library', //optional

// 'showLibrary' => true, //optional
// 'saveOriginal' => 'originalImage', //optional
'generateFilename' => true //optional
),
'cropConfig' => array(
'minWidth' => 588,
'minHeight' => 300,
'aspectRatio' => true, //optional
'cropRoute' => 'comur_api_crop', //optional
'forceResize' => false, //optional
'thumbs' => array( //optional
array(
'maxWidth' => 180,
'maxHeight' => 400,
'useAsFieldImage' => true //optional
)
)
)
))
->getForm();

return ['form' => $form->createView(),];
}`

twig view:
`



{{ form_widget(form) }}

                </div>
            </div>`

show:
comur

@comur
Copy link
Owner

comur commented Jun 23, 2016

Hi @yumoraes
please check in your web inspector to see if you have any 404 or JS errors. I think it's an asset issue

@paulmonty
Copy link

@comur your solution looks great, but I struggle to install it in Sonata.

I got a lot of 404s
zrzut ekranu 2016-07-24 o 01 51 17

and my field looks like this
zrzut ekranu 2016-07-24 o 01 51 27

I pasted
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
<script src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
{% include "ComurImageBundle:Form:croppable_image_modal.html.twig"%}

to standard_layout.html.twig in sonata-project/admin-bundle resources folder.

I would appreciate your help.

@juanwilde
Copy link

Try to perform a "php app/console assets:install --symlink" and it should work

@comur
Copy link
Owner

comur commented Aug 31, 2016

@paulmonty is it ok with @juanwilde 's solution ? can we close this issue ?

@comur
Copy link
Owner

comur commented May 30, 2019

Too old. I close. Feel free to open new issue if you have any problem

@comur comur closed this as completed May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants