+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Adding thumbnail image field to news/events in ver 6.x

Adding thumbnail image field to news/events in ver 6.x

11 posts, 0 answered
  1. Josh Anderson
    Josh Anderson avatar
    48 posts
    Registered:
    15 Dec 2005
    08 Jan 2014
    Link to this post
    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?
  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    08 Dec 2016
    13 Jan 2014
    Link to this post
    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
    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
  3. Josh Anderson
    Josh Anderson avatar
    48 posts
    Registered:
    15 Dec 2005
    13 Jan 2014 in reply to Sabrie Nedzhip
    Link to this post
    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.
  4. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    08 Dec 2016
    16 Jan 2014
    Link to this post
    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
    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
  5. Josh Anderson
    Josh Anderson avatar
    48 posts
    Registered:
    15 Dec 2005
    21 Jan 2014 in reply to Sabrie Nedzhip
    Link to this post
    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?
  6. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    08 Dec 2016
    24 Jan 2014
    Link to this post
    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
    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
  7. Josh Anderson
    Josh Anderson avatar
    48 posts
    Registered:
    15 Dec 2005
    24 Jan 2014 in reply to Sabrie Nedzhip
    Link to this post
    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?
  8. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    08 Dec 2016
    29 Jan 2014
    Link to this post
    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
    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
  9. Chanan Zass
    Chanan Zass avatar
    123 posts
    Registered:
    21 Aug 2012
    27 Sep 2014
    Link to this post

    Hello,

     Has this issue ever been resolved?

    We're having the exact same problem...

    Thanks.

  10. Chanan Zass
    Chanan Zass avatar
    123 posts
    Registered:
    21 Aug 2012
    30 Sep 2014
    Link to this post

    So, for posterity's sake, here's how we resolved this issue:

    1. Followed the instructions listed here: http://www.sitefinity.com/documentation/documentationarticles/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;
        }
    }
    3. Fixed the NewList template used in the News page: went back to the default template and added the necessary code according to the instructions above.

    Worked in our case.

     

     

     

     

  11. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    08 Dec 2016
    01 Oct 2014
    Link to this post
    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
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
11 posts, 0 answered