Need relative NOT absolute paths for custom field that selec

Posted by Community Admin on 04-Aug-2018 22:32

Need relative NOT absolute paths for custom field that selects images to associate with blog/event/news posts

All Replies

Posted by Community Admin on 13-Aug-2013 00:00

I'm not sure where I found the steps that described a very simple way to allow my users to select/upload an image to associate with their blog/news/event posts, but it gave these steps.

1. Add new custom field for blogs
2. Set its type to short text
3. Set "Interface widget for entering data" to Custom
4. In the custom textbox enter:  Telerik.Sitefinity.Web.UI.Fields.ImageField
5. Save the custom field and test it in blog post item.

The problem I'm having is that apparently the URL that is created for that image is absolute. I need it to be a relative. Does anyone know where/if/how I can change it to be a relative path?

Posted by Community Admin on 07-May-2014 00:00

You could simply do something like this:

var i = this.get_ImageSelector();
var imgUrl = (i.get_value() + '').toLowerCase();
imgUrl = imgUrl.substring(imgUrl.indexOf('/images'), imgUrl.length);

 You would need to be careful when site is hosted in virtual directory.

Posted by Community Admin on 18-Jul-2014 00:00

Did you ever get this issue resolved?  I'm running into the exact same issue now and any pointers you have would be appreciated.

 

This thread is closed