Need relative NOT absolute paths for custom field that selects images to associate with blog/event/news posts
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?
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.
Did you ever get this issue resolved? I'm running into the exact same issue now and any pointers you have would be appreciated.