Fernando Molinari | 15 Sep 17:04 2012
Picon

where to save images so they won't be deleted ? - I'm using latest ios - cordova 1.7.0

Hello,


My application allows the user to take a picture and save it on the device. I'm copying the images from the tmp folder to another location according to the following, because if they stay there they will be deleted:

window.resolveLocalFileSystemURI(sessionStorage.recipePicture, resCopyOnSuccess, resCopyOnError);


function resCopyOnSuccess(entry){ 
    var currentTime = new Date();
    fileAndExt = "image" + (currentTime.getMonth() + 1) + currentTime.getDate() + currentTime.getFullYear() + currentTime.getTime();
    
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, 
                             function(fileSys) { 
               fileSys.root.getDirectory("recipe", {create: 
true, exclusive: false}, 
                                              function(directory) {
                                                entry.copyTo(directory, fileAndExt, copySuccess, copyError);
                                                localStorage.hasTmpImage = '';
                                              }, resCopyOnError); 
           }, resCopyOnError);
 } 

With this code the location will be:

file://localhost/var/mobile/applications/DC1.../documents/recipe/imageName

But after an ios update the images are deleted. Where is the right place to save an image (a place where it won't be deleted)?

Thanks for your help,

Fernando

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phonegap-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
phonegap+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
 
 
Shazron | 18 Sep 04:46 2012
Picon

Re: where to save images so they won't be deleted ? - I'm using latest ios - cordova 1.7.0

What is the full path, just to check? It should never be deleted, as
per their guidelines if its in the Documents folder.

On Sat, Sep 15, 2012 at 8:04 AM, Fernando Molinari
<frndmolinari@...> wrote:
> Hello,
>
> My application allows the user to take a picture and save it on the device.
> I'm copying the images from the tmp folder to another location according to
> the following, because if they stay there they will be deleted:
>
> window.resolveLocalFileSystemURI(sessionStorage.recipePicture,
> resCopyOnSuccess, resCopyOnError);
>
>
> function resCopyOnSuccess(entry){
>     var currentTime = new Date();
>     fileAndExt = "image" + (currentTime.getMonth() + 1) +
> currentTime.getDate() + currentTime.getFullYear() + currentTime.getTime();
>
>     window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
>                              function(fileSys) {
>                fileSys.root.getDirectory("recipe", {create:
> true, exclusive: false},
>                                               function(directory) {
>                                                 entry.copyTo(directory,
> fileAndExt, copySuccess, copyError);
>                                                 localStorage.hasTmpImage =
> '';
>                                               }, resCopyOnError);
>            }, resCopyOnError);
>  }
>
> With this code the location will be:
>
> file://localhost/var/mobile/applications/DC1.../documents/recipe/imageName
>
> But after an ios update the images are deleted. Where is the right place to
> save an image (a place where it won't be deleted)?
>
> Thanks for your help,
>
> Fernando
>
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phonegap@...
> To unsubscribe from this group, send email to
> phonegap+unsubscribe@...
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>
> To compile in the cloud, check out build.phonegap.com
>
>

Kerri Shotts | 18 Sep 08:02 2012
Picon

Re: where to save images so they won't be deleted ? - I'm using latest ios - cordova 1.7.0

Have you checked the target directory to verify if the pictures are truly there? Perhaps they're on the filesystem, but your app forgot to look for them there?

Which leads me to the next question: how are you reading the pictures back into your app? Or are you saving the path in local/sessionStorage while also saving the image on the filesystem?


_________________________________________
~Kerri Shotts, photoKandy Studios LLC
   Wanna be our neighbor? Our Facebook page & Twitter feed.

On Saturday, September 15, 2012 at 10:04 AM, Fernando Molinari wrote:

Hello,

My application allows the user to take a picture and save it on the device. I'm copying the images from the tmp folder to another location according to the following, because if they stay there they will be deleted:

window.resolveLocalFileSystemURI(sessionStorage.recipePicture, resCopyOnSuccess, resCopyOnError);


function resCopyOnSuccess(entry){ 
    var currentTime = new Date();
    fileAndExt = "image" + (currentTime.getMonth() + 1) + currentTime.getDate() + currentTime.getFullYear() + currentTime.getTime();
    
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, 
                             function(fileSys) { 
               fileSys.root.getDirectory("recipe", {create: 
true, exclusive: false}, 
                                              function(directory) {
                                                entry.copyTo(directory, fileAndExt, copySuccess, copyError);
                                                localStorage.hasTmpImage = '';
                                              }, resCopyOnError); 
           }, resCopyOnError);
 } 

With this code the location will be:


But after an ios update the images are deleted. Where is the right place to save an image (a place where it won't be deleted)?

Thanks for your help,

Fernando

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phonegap-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
phonegap+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
 
 

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phonegap-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
phonegap+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
 
 
Mohammed Javed | 11 Nov 21:29 2012

Re: where to save images so they won't be deleted ? - I'm using latest ios - cordova 1.7.0

Hi,

I can confirm the same - after an iOS update or 

an app update files that were previously stored in the 

PERMANENT storage area eg: 
file://localhost/var/mobile/Applications/{GUID}/Documents/1.jpg

After an update this file is no longer available.

After some testing: it seems that an update causes the 

app GUID to be recreated and so any existing files 
are no longer available. Eg: 

file://localhost/var/mobile/Applications/{This GUID is recreated}

This does not affect localStorage - that works fine. 

Help! We have a live app and this affects all users.

We are using the latest PhoneGap library: 2.1.0 and building via PhoneGap Build.

Appreciate your help on this,

Javed


Gmane