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

Forums / Developing with Sitefinity / Thumbnail displayed when picked from custom widget

Thumbnail displayed when picked from custom widget

8 posts, 0 answered
  1. AJ
    AJ avatar
    11 posts
    Registered:
    17 Sep 2012
    06 Jul 2012
    Link to this post
    I've created a custom widget that (in the designer) has an image picker field that enables you to choose an image from your libraries (or upload from computer). This image is then displayed on the user facing end of the widget.
    This all works fine, however when the image is displayed I've noticed it is the thumbnail version and not the original as the image source is something like: http://localhost:60876/images/default-album/penguins.jpg.tmb?sfvrsn=0 

    Now, I could just strip off everything after the .tmb but wondered if a) this was safe to do and b) is there a better way of doing this?
  2. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    06 Jul 2012
    Link to this post
    I noticed this same problem and I've fixed it two ways.  The first time I noticed it, I needed to do a quick fix and stripping off the .tmb worked just fine.

    I actually built my own custom widget for this but the "better" way to do this is to access  the URL by using the following code:

    applyChanges: function () {
            var data = this._propertyEditor.get_control();
            // save selected image
            var imageId = this.get_ImageSelector();
            if (imageId && imageId.get_selectedImageItem()) data.ImageSrc = imageId.get_selectedImageItem().Url;
     
          },


    This will get you the real URL to pass back instead of the Thubnail version.  Since you used the designer, I am not sure you are going to be able to access this.
  3. AJ
    AJ avatar
    11 posts
    Registered:
    17 Sep 2012
    09 Jul 2012
    Link to this post
    Is it just a case of removing the ".tmb" from the url or should I remove the whole of  ".tmb?sfvrsn=0" 

    What does the "?sfvrsn=0" do?

    cheers

    Andy
  4. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    09 Jul 2012
    Link to this post
    I believe that would like you display a specific version.  Your example would be the first version or version 0.  When I removed the .tmb I removed everything after it.  From my testing, the "real" url was always the latest version.
  5. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    10 Jul 2012
    Link to this post
    Hi,

    The "?sfvrsn=0" part of the query string is used to display the number of edits that have been done to this image in Sitefinity images module.

    Another way to select an image is to add the built in ImageField. In the dialog for adding custom fields select "Interface widget for entering data" to be "Custom" and in the custom textbox enter
    Telerik.Sitefinity.Web.UI.Fields.ImageField which will add the built in image selector.
    This selector always select the original image, not its thumbnail.

    Greetings,
    Stanislav Velikov
    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
  6. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    10 Jul 2012
    Link to this post
    What's the "default"?, When I originally encountered ths problem, I used the method ImageField.get_value() and it returned the Thumbnail url.  It wasn't until I used ImageField.get_selectedImageItem().Url did I get the actual image URL from the ImageField.
  7. Gema
    Gema avatar
    46 posts
    Registered:
    02 Oct 2009
    12 Dec 2012 in reply to Stanislav Velikov
    Link to this post
    Hi Stanislav,
    I've added a custom field to News items.
    I've used Telerik.Sitefinity.Web.UI.Fields.ImageField for that field as you have recomended before, but that field is still saveing the thumbnail image.

    Is it a bug?, or,  Do I have to configure something to get the original image url?

    Thanks !
  8. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    17 Dec 2012
    Link to this post
    Hi,

    The ImageField control will always select a thumbnail as its main purpose is to select user avatar image which is thumbnail. For selecting full sized images use a control utilizing MediaContentSelectorView with DialogMode="Image" from this blog post.
    <sf:EditorContentManagerDialog runat="server" ID="asyncImageSelector" DialogMode="Image" Width="540" HostedInRadWindow="false"  BodyCssClass="" />


    Greetings,
    Stanislav Velikov
    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
8 posts, 0 answered