Adding thumbnail image field to news/events in ver 6.x
I'd like to add a thumbnail image option to the news and events content, and I implemented the solution outlined in this blog post: http://www.sitefinity.com/blogs/slavoingilizov/posts/slavo-ingilizovs-blog/2011/09/09/extend_the_image_selector_for_content_items_with_filtering_by_album
However, apparently in 6.x the image management has been made hierarchical, which means this sample outputs a GUID instead of the image URL. In the comments on the blog post there apparently is updated code for 6.x...does anyone have it to share?
Hello Josh Anderson,
Please find attached the updated sample about associating a content item with an image. I have just tested the sample in Sitefinity 6.3.5000.0 following the instructions in the blog post you have linked and it works properly. Please note that you need to add reference to the missing assemblies in your ThumbnailSelectorField project from the bin folder of your Sitefinity project.
Regards,
Sabrie Nedzhip
Telerik
It looks like nothing has changed in the code. The issue I'm having is that when I select an image, a GUID is put in the field. The comments (screen shot attached) on the blog post I referenced indicated that this behavior is a result of a change in how images are handled. Also, the references were replaced originally, so that's not the problem.
See the attached image for what happens when I select an image.
Hi Josh Anderson,
Thank you for the feedback. We are working on improving the sample to get it work for Sitefinity 6.x. I have attached the project with the latest updates for your convenience. The blog post will also be updated in the recent future.
Regards,
Sabrie Nedzhip
Telerik
What changed in the project you attached? I still get only a GUID when selecting an image, and it appears that only the SimpleImageField.ascx and the SimpleImageField.js were changed. Is there more that needs to be updated?
Hello Josh,
The changes which have been made to the sample are to enable the users to select images from nested libraries in their projects. I have recorded a video demonstrating it.
The updated blog post will probably be published next week. You can use the sample as a base which you can further modify and improve in order to fit your case scenario.
Regards,
Sabrie Nedzhip
Telerik
I'm really confused now. In your video it shows the exact issue I'm having. You select an image and instead of the URL it has a GUID. Somehow, in your video it still works. On my system, if I publish the event with the GUID in that thumbnail field, it doesn't work because the image src attribute is set to that GUID.
How, if as in the video you put a GUI in the thumbnail field, does Sitefinity know to translate that to an image URL?
Hello Josh,
The image src attribute is set to the image path on my side. Please refer to the screenshot. Can you please make sure if you are not missing any step or if you perform any step incompletely.
Regards,
Sabrie Nedzhip
Telerik
Hello,
Has this issue ever been resolved?
We're having the exact same problem...
Thanks.
So, for posterity's sake, here's how we resolved this issue:
1. Followed the instructions listed here: www.sitefinity.com/.../download-and-install-the-image-selector
2. Edited the SimpleImageField.cs file which caused errors, at least in my case (we don't have thumbnails for each and every news item):
public override object Value
get
var val = string.Empty;
switch (this.DisplayMode)
case FieldDisplayMode.Read:
val = this.ImageUrl;
break;
case FieldDisplayMode.Write:
val = this.TextBoxControl.Text;
break;
return val;
set
switch (this.DisplayMode)
case FieldDisplayMode.Write:
this.TextBoxControl.Text = value as string;
break;
case FieldDisplayMode.Read:
if (value != null)
if (value.ToString() != String.Empty)
var imageId = new Guid(value.ToString());
var url = App.WorkWith().Image(imageId).Get().MediaUrl;
this.ImageControl.ImageUrl = url + "&size=100";
this.ImageUrl = this.ImageControl.ImageUrl;
break;
base.Value = null;
Worked in our case.
Hi Chanan,
I am glad to hear that you have managed to resolve the issue and thank you very much for sharing in details the solution with the community. This will help other people experiencing the same issue.
Regards,
Sabrie Nedzhip
Telerik