Thumbnail displayed when picked from custom widget
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?
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.
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
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.
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
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.
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 !
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
=
""
/>