Unplanned
Last Updated: 09 Jun 2020 07:23 by ADMIN
Imported User
Created on: 06 Feb 2013 20:49
Category: Editor
Type: Feature Request
4
Make imagebrowser.transport.imageUrl and imagebrowser.transport.thumbnailUrl consistant with the other transport properties.
I want to use the ImageBrowser with services that perform the requested operations.. I've got my transport.read, transport.create, transport.destroy services created just fine and everything works.

However, the imageUrl and thumbnailUrl properties leave me baffled.


So transport.thumbnailUrl hard-codes a ?path={url} to whatever url you give it ... this seems like a major hack. I want to use a REST service with the generation of the thumbnail and I need to supply additional query string parameters, but the current implementation precludes doing so.

At least imageUrl lets me pass in a function or a parameterized string, but imageUrl ALWAYS tacks on the current relative path. The images that I'm using get stored in a DB by the service, so doing so makes no sense.

Both these properties should have the same abilities as the create,read, and destroy -- let me control what is passed in explicitly.
3 comments
ADMIN
Veselin Tsvetanov
Posted on: 09 Jun 2020 07:23

Hello Christian,

Thank you for your input on the discussion.

As per the uploadUrl case, there is a workaround that might be applicable to your scenario. That option is used by a Kendo Upload widget, which sends the file in question to the remote endpoint. You could add a custom header to that request by handling the upload event of the Upload widget as explained in the following forum thread:

https://www.telerik.com/forums/custom-authorization-header-for-upload#FRi3NUFssUe8V3kzirsLoQ

In the Editor scenario, that could be done in the execute event of the widget:

execute: function(e) {
  setTimeout(function() {
    var upload = $('.k-filebrowser-dialog input[data-role="upload"]').getKendoUpload();

    if(upload) {
      upload.unbind('upload');
      upload.bind('upload', function(ev) {
        var xhr = ev.XMLHttpRequest;

        if (xhr) {
          xhr.addEventListener("readystatechange", function onReady(e) {
            if (xhr.readyState == 1 /* OPENED */) {
              xhr.setRequestHeader("foo", "bar");

              xhr.removeEventListener("readystatechange", onReady);
            }
          });
        }
      })
    }
  });
},

Here is a small Dojo sample implementing the above suggestion:

https://dojo.telerik.com/ogulUqiZ/7

Regards,
Veselin Tsvetanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Christian
Posted on: 02 Jun 2020 10:15

The uploadUrl parameter is also out of standard.

I request to have the option to add an authorization header here.

evb
Posted on: 19 Jan 2017 14:07
And making the imageUrl and thumbnailUrl like the other transport properties will allow to set an antiforgery token in the headers when you need that.