SaaS CMS has officially launched! Learn more now.

Fetch image directly from blob instead of from CMS propety

Vote:
 

Hi,

Is it possible to get image directly from blob folder with the image name?

I haven't created any CMS property for the image.

Thanks,

Manjeera T

#175798
Mar 02, 2017 12:28
Vote:
 
Url.ContentUrl([ContentReferenceToBlob])

That demands that you know the contentreference to the image

#175800
Mar 02, 2017 13:03
Vote:
 

Hi,

When you say blob folder, do you mean the actual folder on disk or in blob storage in Azure? Or are you referring to the folder created inside the CMS? If the latter: Get the reference to the folder, e.g. var folder = new ContentReference(theIdOfTheFolder). Then get all children to the folder with var images = IContentLoader.GetChildren<MediaData>(folder). Lastly loop through all image and find the one with the name you're looking for var image = image.FirstOrDefault(x => x.Name.Equals("theNameYoureLookingFor")) .

#175805
Mar 02, 2017 15:03
Vote:
 

I would probably ask why you want to get hold of the image directly? Is there something you cannot do with the Episerver API? 

#175813
Mar 02, 2017 17:13
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.