How do I take a view image (html) and send it to a controller (php) using codeigniter?

Asked

Viewed 291 times

0

I need to give a picture of mine view to the controller, be it just the string with the url or the whole html element, for me it doesn’t matter because I will use to mount a pdf through the mpdf, am using angular and codeigniter and the mpdf is not letting me generate through AJAX request, I am playing the parameters directly in the URL and solving the route through the Routes.php of ci to directly call a function in the controller, to generate the pdf, the problem is that the URL of my image is the one that google generates for png image google Charts, is gigantic and I can’t do playing straight into the URL like the other parameters, someone can help me?

  • Your text is a bit confusing. Would you like to pass a Base64 to the server and use it there? Another alternative is to fire a form with the image via js.

  • I think the same idea would be to shorten the image url that google Chart generates, in a dynamic way, I think Base64 would be more laborious not? and the form would not be an option because I need the button to be a link

  • The form can be hidden and the shot of it can be the click, all this with js.

  • In the case of Base64, I never really did so. But honestly, it seems that the best solution is you send via POST even.

1 answer

1

  • did not give error but tbm did not work, the img_url will receive the generated url right? the problem I think is on course, because the angular is treating route in this case

  • I don’t know much about Angular, but there must be some way there to call the routes from the external API and not from Angular. Even if you specify the absolute link of the route. But, if I’m not mistaken, the angular only takes the links from the #/ is not it? Try to put the full link of the route, ex: http://minhaaplicacaolocal.app/minharota

  • in fact so I can even solve the route, but I want to use this variable that is the link in a route already solved understand? like a route that already directs me to a function in the controller class, I wanted to simply take the value inside it, I don’t know what that route would call in the codeigniter Routes.php

  • when I solve the route in js I won’t have to call a method from my controller class?

  • I place the method in which I am using the $this->input->post('img');

  • Theoretically, just by creating the route and pointing the Controller, everything will be on it. Be it Post or Get, then you will be able to catch the image. $this->input->post('img') you will be able to use if the controller has an input instance injected into it, probably something standard in codeigniter.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.