Adam
Adam

Reputation: 464

Image URL to Base64

Are there any public Web Service APIs that allow submission of an Image URL and return a Base64 encoded version of that image? Here's an example: http://software.hixie.ch/utilities/cgi/data/data

Two reasons I want this:

  1. I don't know much server-side, so it would be nice to avoid coding it myself.
  2. Using the HTML5 Canvas + external URLs + .toDataURL = Security Exception (cross domain issue)

Upvotes: 0

Views: 1760

Answers (2)

Marc B
Marc B

Reputation: 360572

Without any security considerations, you can do this VERY trivially in php:

<?php

echo base64_encode(file_get_contents($_GET['url']));

Don't be scared of "server-side".

Upvotes: 3

Related Questions