I'm creating a blob file using the following method in my code
Adding to Blob
Thumbnail = MediaToBlob(thumbMediaUrl, accessToken, ".jpg", blobFactory, qbankMedia, "text/html");
blobCache.Add(videoMediaUrl, qbankMedia.BinaryData);
MediaToBlob Method
public Blob MediaToBlob(string mediaUrl, string accessToken, string extension, IBlobFactory blobFactory, IQBankEpiMedia qbankMedia, string mimeType, int maxLength = int.MaxValue)
{
var mediaStream = GetMediaStream(mediaUrl, accessToken, mimeType, maxLength);
Blob blob = null;
if (mediaStream != null)
{
blob = blobFactory.CreateBlob(qbankMedia.BinaryDataContainer, extension);
using (var blobStream = blob.OpenWrite())
{
byte[] buffer = new byte[64 * 1024];
int read;
while ((read = mediaStream.Read(buffer, 0, buffer.Length)) > 0)
blobStream.Write(buffer, 0, read);
mediaStream.Flush();
mediaStream.Close();
}
}
return blob;
}
I Need to get a relative path to this Thumbnail object so that I can use it to render the image in site. I can use Thumbnail.ID.AbsoluteUri to get this :
epi.fx.blob://default/f791355aa6334c92b5f370c5cfafd971/adc882777a04431baae83a2e05f3f02d.jpg
instead of that, i need something like this:
http://localhost:8000/episerver/f791355aa6334c92b5f370c5cfafd971/adc882777a04431baae83a2e05f3f02d.jpg
Can anyone guide me to have something that I can use as normal Url for images?
You can access thumbnail properties by appending the property name to the URL:
This works for any thumbnail property your content type might have. 'Thumbnail' is the default propety available on ImageData.