Qlik Community

QlikView Extensions

Discussion Board for collaboration on QlikView Extensions.

Not applicable

Display a local image in an extension object?

I can display a div in an extension object with a hot-linked image from the web easily enough:

Qva.AddExtension('ShowImage', function() {

          this.Element.innerHTML = "<div style='width=200px; height:200px; background-image:url(http://www.some.image.jpg)'></div>";

});

But does anybody know how to show an image held locally inside the extension folder (i.e. sitting alongside your definition.xml, script.js and Icon.png)? I've been playing around without success and can't find any documentation or examples. I was hoping CSS 'background-image:url(local-image-in-extension-folder.jpg)' would work, but diesn't seem to.

Thanks!

Tags (1)
1 Solution

Accepted Solutions
Employee
Employee

Re: Display a local image in an extension object?

Hi,

In all of my extensions I set a variable called path to use for locally stored images and things:

var path = Qva.Remote + "?public=only&name=Extensions/ShowImage/";

So you would adjust your code to be:

this.Element.innerHTML = "<div style='width=200px; height:200px; background-image:url(" + path + "some.image.jpg)'></div>";

7 Replies
Employee
Employee

Re: Display a local image in an extension object?

Hi,

In all of my extensions I set a variable called path to use for locally stored images and things:

var path = Qva.Remote + "?public=only&name=Extensions/ShowImage/";

So you would adjust your code to be:

this.Element.innerHTML = "<div style='width=200px; height:200px; background-image:url(" + path + "some.image.jpg)'></div>";

Not applicable

Re: Display a local image in an extension object?

Awesome, thanks Brian! That works

Partner
Partner

Re: Display a local image in an extension object?

Brian I have to develop a strategic map based on the balanced scorecard, I was thinking of your org chart as basis for that, can you give me some pointers on how to add custom images to that chart (like the led images inluded in QV)?

Thanks in advance.

warfollowmy_ver
Contributor III

Re: Display a local image in an extension object?

bmz, how can I connect a folder from another server?

\\other_server\folder\

Because I can use external sources via http, can I also receive data from another server as locally?

Highlighted
Employee
Employee

Re: Display a local image in an extension object?

You should be able to reference files from another location as long as they're accessible from wherever your extension is running.

Employee
Employee

Re: Display a local image in an extension object?

Actually, not sure I understand your question.  What do you mean by "receive data" from another server?  Do you mean that you want to call out to another server and pull data into the extension to display there?  That should definitely be possible.

warfollowmy_ver
Contributor III

Re: Display a local image in an extension object?

Thank you, the case is closed.

Re: Connect a folder from another server