I need to pass a full url as a route parameter on my laravel 5 application, the thing is as follows. I'm creating a thumbnail service that having the url of the original photo resizes it and streams it back to the browser.
For example, I need the img source to have an src like this:
url_encode() will make that URL safe to pass as a GET parameter.
Edit for comment:
This doesn't work because of the way Laravel is parsing the URL and it's parameters. It sees 300x300/http:// and finds an empty parameter. If you can remove the http:// and still have your functionality then it will work just fine. urlencode is not going to fix this problem.
The issue that you're running into is that the url parameters are, by default, delimited by forward slashes (/). Since one of your parameters will contain forward slashes, you run into a special situation.
Given your current route definition, and given the url http://host.com/generate-thumb/300x300/http://host.com/images/media1.png, what happens is that your size parameter gets 300x300, your original_url parameter gets http:, and then there are a bunch more parameters. Since you don't have a route defined like this, you get a 404.
In order to allow a parameter to accept forward slashes, you will need to define a regex constraint for that parameter. You need to define your route like this:
This .* constraint will allow this parameter to accept any character, including forward slashes. Note that when you do this, this parameter will need to be the last defined parameter, since it eats all the forward slashes and you won't be able to delimit any other route parameters.