언어 설정

Menu
Sites
Language
image pick problem

hey guys,

im tired about pick an image and store path in localstorage. anyone can help me to store image path and load image path in background ?

thank you for your time.

 

My Code:

var appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/pick", null, "image/*");
				var appControlReplyCallback = {
				    onsuccess: function(data) {
				       for ( var i = 0; i < data.length; i++ ) {
				    	   if ( data[ i ].key == "http://tizen.org/appcontrol/data/selected" ) {
				    		   var path = data[ i ].value[ 0 ];
				    		   localStorage.setItem("custombgurl", path);
				    	   }
				       }
				    },
				    onfailure: function() {
				       console.log('The launch application control failed');
				    }
				};
			 
				tizen.application.launchAppControl(appControl, null,
					function() {console.log("launch application control succeed"); },
					function(e) {console.log("launch application control failed. reason: " + e.message); },
			        appControlReplyCallback
				);

path not saved in localstorage

  localStorage.setItem("custombgurl", path);

 

Edited by: aMir Sirati on 12 4월, 2016
답변 바로가기

Responses

4 댓글
Marco Buettner

Whats exactly your problem? Did u get an error? Did u check if "path" are correct data?
 

aMir Sirati

Hi Marco Buettner

path not saved in localstorage

  localStorage.setItem("custombgurl", path);

 

i use this code for set background path and not showed any background image:

  var custombgurl = SON.parse(localStorage.getItem("custombgurl"));
        document.getElementsByTagName('body')[0].style.backgroundImage = "url('"+[custombgurl]+"')";

 

think you for you reply

Mark as answer
AVSukhov

hello,

Make sure that you use "JSON.parse" instead "SON.parse"

aMir Sirati

tyvm bro , its fixed.