Page 2 of 6

Photo just taken, how to add to a photo album?

Posted: Mon Jun 17, 2013 4:38 pm
by John Herdean

this is the only question Im needing an answer as of now. That might change after i play with the local storage thing...?? Thanks..


Photo just taken, how to add to a photo album?

Posted: Mon Jun 17, 2013 8:44 pm
by John Herdean

Hi, is this code supposed to store all of the pics the user just taken with the above technique?:

try {
localStorage.setItem("picData", "data from service");
} catch ( e ) {
if (e == QUOTA_EXCEEDED_ERR) {
// do something nice to notify your users
}
}


Photo just taken, how to add to a photo album?

Posted: Mon Jun 17, 2013 8:45 pm
by John Herdean

what is "picData and "data from service" supposed to mean?


Photo just taken, how to add to a photo album?

Posted: Mon Jun 17, 2013 8:46 pm
by John Herdean

... "picData" ...


Photo just taken, how to add to a photo album?

Posted: Mon Jun 17, 2013 9:11 pm
by John Herdean

I'm also looking for the JS code that would store all the pics just taken that is in a Panel... Thanks??


Photo just taken, how to add to a photo album?

Posted: Mon Jun 17, 2013 9:12 pm
by John Herdean

more specifically, to store the pics in a localStorage Item(s), thanks??


Photo just taken, how to add to a photo album?

Posted: Tue Jun 18, 2013 7:38 am
by Maryna Brodina

Hello!
1) To make photo slider you would need to use jquery plugin https://www.google.com.ua/search?q=jq....
2) To save images to localStorage on service success run the following code:
codevar picData;
try {
picData = JSON.parse(localStorage.getItem("picData"));
if ({}.toString.call(picData) !== "[object Array]") {
picData = [];
}
} catch ( e ) {
picData = [];
}

try {
picData.push(data.imageDataBase64);
localStorage.setItem("picData", JSON.stringify(picData));
} catch ( e ) {
if (e == QUOTA_EXCEEDED_ERR) {
// do something nice to notify your users
}
}/code

all images will be saved in localStorage as json array in picData variable:
To get them from localStorage to JS variable:
codevar picData;
try {
picData = JSON.parse(localStorage.getItem("picData"));
if ({}.toString.call(picData) !== "[object Array]") {
picData = [];
}
} catch ( e ) {
picData = [];
}/code


Photo just taken, how to add to a photo album?

Posted: Thu Jun 20, 2013 5:43 pm
by John Herdean

is it possible to see whats in the local storage like you can if it would be a text? I tried this code and doesnt work:

alert(localStorage.getItem('picData'));


Photo just taken, how to add to a photo album?

Posted: Thu Jun 20, 2013 5:44 pm
by John Herdean

also, is 'picData' in your above code referring to the local storage variable name i would use?


Photo just taken, how to add to a photo album?

Posted: Thu Jun 20, 2013 7:41 pm
by Kateryna Grynko

Hi John,
[quote:]is it possible to see whats in the local storage like you can if it would be a text?[/quote]Yes, in browser developer tools (where exactly - depends on browser). But this is a long string consists of letters and numbers, nothing readable.
[quote:] is 'picData' in your above code referring to the local storage variable name i would use?[/quote]Yes, this is the same variable inside of your app.