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

Return image base64 encoded #59

Closed
kleisauke opened this Issue Feb 12, 2017 · 0 comments

Comments

2 participants
@kleisauke
Member

kleisauke commented Feb 12, 2017

Return image base64 encoded [4522336]

Submitted by Nick @ www.merq.org on 2-10-2013 0:00:00
14 votes on UserVoice prior to migration

Hello,
I like your service very much!
Could you please add a parameter for encoding?
Example: &encoding=base64 returns the base64_encode($image) string.
Thats very useful for embedding images directly. And the string is cached via Cloudflare. So it's fast and efficient.
Thanks!

Response

by Andries Louw Wolthuizen on 8-12-2013 0:00:00

Wrote the code, please help by testing it.
Example usage:
http://images.weserv.nl/?url=www.google.nl/logos/logo.gif&h=20&w=29&t=absolute&encoding=base64
This will return a string which can be used directly in the src= of a -tag:
Let me know if you run into any problems, thanks!

Comments

Comment by Nick @ www.merq.org on 6-10-2013 12:57:00

Thanks!
I am very excited about this feature and hope that it will be integrated soon :)

Comment by Andries Louw Wolthuizen (Webmaster, Images.weserv.nl - Image cache & resize proxy) on 6-10-2013 15:33:00

Update: Also fixed some problems when the proxy runs into an error. If you use base64, and an error occures, it will return "data:text/plain;Error". If you want to know the full details of the error, you need to remove "&encoding=base64" to see the full message.
This is to prevent XSS-injection of error messages into your tag.

Comment by Nick @ www.merq.org on 6-10-2013 16:35:00

Thanks for this fast implementation!
I let you know if there are any issues.

Original UserVoice Submission

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment