John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

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

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

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

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

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
}
}

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

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

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

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

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

... "picData" ...

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

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

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

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

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

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

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

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

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

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

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'));

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

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

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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Return to “Issues”