Getting Image URL using GetValue

Posted by Community Admin on 04-Aug-2018 17:16

Getting Image URL using GetValue

All Replies

Posted by Community Admin on 17-Oct-2013 00:00

Hi,

How can I get the URL of an image using a custom widget?

I can get all the text field values by using:
image.GetValue("Heading").ToString()

But, not sure how I can get an image URL.

Thanks,

Gary

Posted by Community Admin on 17-Oct-2013 00:00

is image the Image model from the Images module in Sitefinity? All MediaContent items have a ItemDefaulUrl property as well as a MediaUrl and even ThumbnailUrl that you can use to access these properties directly.

If instead you're trying to get a Custom Field of type Media (image) this value is actually stored a s a GUID LINK to the image, not the image itself. I don't know if this has been improved in the recent release but if not you have to manually use this to get the media url from the guid.

There's more information and an example of this here: Retrieving Data From Dynamic Modules Using the Module Builder API

I hope this is helpful, let me know if I've misunderstood your question

This thread is closed