ImageSelector with Relative URL

Posted by Community Admin on 04-Aug-2018 00:05

ImageSelector with Relative URL

All Replies

Posted by Community Admin on 26-Feb-2012 00:00

Hello,

I ran into the "important note" on this issue: www.sitefinity.com/.../selecting_sitefinity_4_content_inside_widget_designers.aspx

Important Note: the value persisted in string mode is the full url to the image, including the host name. So if you are working in a development or staging environment, you might get a url that begins with http://localhost. Be sure to update your widget properties when deploying to production.

The rest of the setup for ImageField is similar to PageField, so it is omitted here. Please take a look at the sample project below for the complete implementation.

My question is is there any suggested code based work around so that we can store the relative image path instead of the full image path?  Also is there a suggested SQL find/replace script I can run to fix this when moving from dev to production with already chosen content?

Posted by Community Admin on 29-Feb-2012 00:00

Hi Kunal,

 Actually you can modify the saved value in the getValue method of the image field's script part (but that would be hacking of the default ImageField). An easier approach would be to use Slavo's Thumbnail selector, which saves guids in the database (rather than links) and is a lot better for this case than the ImageField. Here's you can find the image selector :
http://www.sitefinity.com/blogs/slavoingilizov/posts/11-02-11/creating_a_thumbnail_selector_for_news_items.aspx 

Greetings,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed