Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Images saved from camera or photogallery are not persisting after updating the app

$
0
0

The images persist when the app is open and closed, but when the app is updated from studio, the images are no longer available. I this normal? Do I need to save them somewhere else?

function insertdb(z_image, z_path, z_id) {
 
                    var commons = require("/ui/db/db");
                    var db2 = commons.getDb_DDX();
                    var tracer = require("/ui/common/tracer");
                    var dbLog2 = tracer.createTracer('db2');
                    dbLog2.info('opening database');
 
                    dbLog2.info('starting BEGIN');
                    db2.execute('BEGIN');
                    dbLog2.info('starting insert');
 
                    db2.execute('UPDATE notes SET  z_image=?,z_path=? WHERE z_id= ?', z_image, z_path, z_id);
 
                    alert('Saved');
                    Ti.App.fireEvent("notes", setArray);
 
                    dbLog2.info('finished inserts');
                    dbLog2.info('starting commit');
                    db2.execute('COMMIT');
                    dbLog2.info('finished commit');
                    dbLog2.info('closing database');
                    db2.close();
                    dbLog2.info('database save complete');
 
               }
I am saving the image:
//checking if it is photo
                                   if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) {
                                        anImageView.image = image2;
 
                                        var time = new Date();
 
                                        var name = 'name' + time.getTime() + '.png';
                                        var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, name);
                                        f.write(event.media);
                                        Ti.API.info('f.nativePath' + f.nativePath);
                                        insertdb(name, f.nativePath, prodCat);
 
                                   }

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>