0

I want to fetch remote images and do some image transformation specifically an overlay over an image with cloudinary. But cloudinary only supports 64base safe urls to overlay images. Lets say I have this following remote image URL.

https://scontent.xx.fbcdn.net/v/t1.0-9/15665479_1260320054027269_4201232212927955955_n.jpg?oh=ee01f2ec47b2e972bc12f99d988db241&oe=5946A159

How can I encode it to a 64base url? I have been through many SO questions related to the question but none of them were helped me to solve the issue.

BeanMRCode
  • 61
  • 3
  • 9

1 Answers1

2

In case you need to encode both URL and Image (may not be what you need, but might be useful sometime)

string url = "https://scontent.xx.fbcdn.net/v/t1.0-9/15665479_1260320054027269_4201232212927955955_n.jpg?oh=ee01f2ec47b2e972bc12f99d988db241&oe=5946A159";

string encodedUrl = Convert.ToBase64String(Encoding.Default.GetBytes(url));

using (var client = new WebClient())
{
    byte[] dataBytes = client.DownloadData(new Uri(url));
    string encodedFileAsBase64 = Convert.ToBase64String(dataBytes);
}
Rodrigo Vedovato
  • 1,008
  • 6
  • 11
  • I take this as answer as it does what I asked for but if you please have a look at the [following](http://stackoverflow.com/questions/39337286/overlay-a-fetched-image-over-itself-with-transformations-with-cloudinary) url and see if you can further help me with the issue. – BeanMRCode Feb 17 '17 at 11:55