Thumbnail displayed when picked from custom widget

Posted by Community Admin on 04-Aug-2018 08:21

Thumbnail displayed when picked from custom widget

All Replies

Posted by Community Admin on 06-Jul-2012 00:00

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: localhost:60876/.../penguins.jpg.tmb 

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?

Posted by Community Admin on 06-Jul-2012 00:00

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.

Posted by Community Admin on 09-Jul-2012 00:00

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

Posted by Community Admin on 09-Jul-2012 00:00

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.

Posted by Community Admin on 10-Jul-2012 00:00

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

Posted by Community Admin on 10-Jul-2012 00:00

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.

Posted by Community Admin on 12-Dec-2012 00:00

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 !

Posted by Community Admin on 17-Dec-2012 00:00

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

This thread is closed