Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8859

Kentico 8.2 image to base64

$
0
0
I am trying to convert an image to base64 in order to display it in a vCard (ver 4). I have tried using:MediaFileInfo imageFile = MediaFileInfoProvider.GetMediaFileInfo(SiteContext.CurrentSiteName, filePath, null); However imageFile.FileBinary is null (everything else e.g. FileSize, ID, GUID etc. are correct). Any idea why this is the case?I've also tried using a FileStream:FileStream file = FileStream.New(filePath, FileMode.Open, FileAccess.Read); Image imageFile = Image.FromStream(file.SystemStream); The problem I'm running into here is that it seems to expect filePath to be an absolute path. I have to use a relative path. Is there perhaps a better way to do this?

Viewing all articles
Browse latest Browse all 8859

Trending Articles