Image path - Widget

I’m trying to show an image in my widget but it is not working…

If I “put” a image from a normal path it works, like:

img/myImage.png

But if I try an “external” path it does not work, like:

/home/owner/media/DCIM/myImage.png

The interesting point is that the widget allow me to select an external image using appControll, but still the image does not show:

var appControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/pick', null, 'image/*', null, null);

	tizen.application.launchAppControl(appControl, null, null, null, {
	    onsuccess: function(data) {
		       for(var i = 0; i < data.length; i++) {
		    	   if(data[i].key == "http://tizen.org/appcontrol/data/selected") {
		    		   document.getElementById("img").src = data[i].value[0];
                       break;
		    	   }
		       }
		    }, onfailure: function() {
		    		//...
		    }
		}
	);

The documentation says that I cannot load external images, but the only examples they give is about image stored in web pages or servers… they do not say anything about “internal external” images…

Thank you for your time!

Hi,
Web widgets use only a subset of HTML, CSS, and DOM APIs available for Web applications. Since a design goal of widgets is to provide a quick view of the widget content to the user, there are some restrictions in the Web widget implementation to prevent unnecessary performance degradation:

  • Web widgets cannot use external network resource loading (for example, CSS, JavaScript, and image files).
  • The total size of the HTML, CSS, and JavaScript files in the widget is limited to less than 50 Kbytes.
  • The image resolution in a widget must be less than 1.5 times the base image resolution of the Web Widget Specification.
  • Only JPEG, PNG, and GIF formats are allowed for image files.

Please check more about this here,
https://docs.tizen.org/application/web/guides/applications/web-widget/

Thank you,
Iqbal
Samsung Developer Program

1 Like

Hi, as I said I already read the documentation, thanks… And as I said they say in the documentation “external network”, they don’t say anything about files that are in the device…

I’ve checked some apps o Galaxy Store… there is a way of doing that…

Please check condition no 2,3,4