Can't View Exported Image

The place to discuss anything and everything about running your LiveCode on Android

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Can't View Exported Image

Postby Prabhavins » Mon Sep 11, 2017 1:03 pm

Hi,
I am trying to save images for the profile picture in sqllite database. I just move the images to the specific folder and save the image name in sqllite.But in android i could not find the image. Can you please help me

Thanks in advance.

Regards,
Anbu
Prabhavins
 
Posts: 5
Joined: Thu Jun 29, 2017 1:00 pm

Re: Can't View Exported Image

Postby Klaus » Mon Sep 11, 2017 1:08 pm

Hi Anbu,

welcome to the forum! :D

Please give us some more info and post the script your are using to store
the pathname and what pathname (specific folder?) do you save?


Best

Klaus
Klaus
 
Posts: 9488
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany

Re: Can't View Exported Image

Postby Prabhavins » Mon Sep 11, 2017 1:23 pm

Hi klaus,

This is my code. I could not find the image "Success.png" in my android mobile.

on mouseUp
set the lockloc of the templateimage to true
set the width of the templateimage to "322"
set the height of the templateimage to "255"
set the left of the templateimage to "30"
set the top of the templateimage to "181"
if the platform is "iphone" then
mobilePickPhoto "Album", 600,600
else
mobilePickPhoto "library" , 320,410
end if
put the last image into img "ViewImage"
export img "ViewImage" to file "success.png" as JPEG
end mouseUp



Regards,
Anbu
Prabhavins
 
Posts: 5
Joined: Thu Jun 29, 2017 1:00 pm

Re: Can't View Exported Image

Postby Klaus » Mon Sep 11, 2017 2:08 pm

Hi anbu,

Code: Select all
...
export img "ViewImage" to file "success.png" as JPEG
...

you are using a relative pathname here, but at that point "the defaultfolder" is probably some folder
inside of the application package where your app does NOT have write permission.
So the script silenty fails at this point. You can check this by adding something like:
Code: Select all
...
export img "ViewImage" to file "success.png" as JPEG
if the result <> EMPTY then
  answer "Error:" && the result
end if
...

If no error occurs, the result will be empty, otherwise it may give you a hint.

But that will not help you much in this situation, so better use something like this:
Code: Select all
...
## This is the only folder on the mobile platform (Android and iOS) where we have write permission AND we should use the correct file suffix! 8-)
put specialfolderpath("documents") & "/success.jpg" into tFile
## export img "ViewImage" to file "success.png" as JPEG
export img "ViewImage" to file tFile as JPEG
...


Best

Klaus
Klaus
 
Posts: 9488
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany

Re: Can't View Exported Image

Postby Prabhavins » Mon Sep 11, 2017 3:32 pm

Hi Klaus,

I get the result as empty but i cant view the image in documents folder in android.But in Windows i can see the image in documents.Can i get any suggesstion?

Regards,
Prabha.M
Prabhavins
 
Posts: 5
Joined: Thu Jun 29, 2017 1:00 pm

Re: Can't View Exported Image

Postby Klaus » Mon Sep 11, 2017 4:30 pm

Prabhavins wrote:I get the result as empty but i cant view the image in documents folder in android.

How do you check this? With Livecode? If yes, how?

Hint: Really NO need to put numbers in quotes!
Klaus
 
Posts: 9488
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany

Re: Can't View Exported Image

Postby quailcreek » Tue Sep 12, 2017 12:20 am

As it happens I'm currently working on something similar. I'm saving the pic as a .png but you can change it to .jpg

The specific folder the pic is getting save to (tPicFolder) is pulled from the Db. That's he first line.
The second line puts the full path into tFolderPath
The third line builds a unique name for the pic based upon the row ID in the Db (tCarID), which is pulled from the Db when tPicFolder is pulled.
The last line puts everything together and saves the pic. sTheNewImage is the ID of the image element (not the pic image) that has the pic I want to save. It's defined high in the script.

Code: Select all
put item 2 of tPicData into tPicFolder
      put specialfolderpath("documents") & "/StoreddPics/" & tPicFolder into tFolderPath
      put tCarID & "_" & tPicNum & ".png"  into tPicName
      export image ID sTheNewImage_ID to URL("binfile:" & tFolderPath & "/" & tPicName) as PNG
Tom
MacBook Pro OS 10.12.5
quailcreek
 
Posts: 585
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: Can't View Exported Image

Postby jacque » Tue Sep 12, 2017 5:30 pm

Prabhavins wrote:Hi Klaus,

I get the result as empty but i cant view the image in documents folder in android.


Android is sandboxed and the image might go into the private documents area of the app. It will not be saved to the public shared documents folder so if you are using a file manager to look for it, it won't be there. You can't see the app's document folder without rooting the device.

To see if the image was saved, you can ask in a script.

Code: Select all
answer there is a file specialfolderpath("documents") & "/success.jpg"
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3794
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Can't View Exported Image

Postby Prabhavins » Wed Sep 13, 2017 5:58 am

Hi,

But i have to view the image again in my application from the saved path.How can i do that?
Please advise.

Regards,
Prabha.M
Prabhavins
 
Posts: 5
Joined: Thu Jun 29, 2017 1:00 pm

Re: Can't View Exported Image

Postby jacque » Wed Sep 13, 2017 4:27 pm

Prabhavins wrote:But i have to view the image again in my application from the saved path.How can i do that?


Create an image object and assign the file path:

Code: Select all
create img "display"
set the filename of img "display" to specialfolderpath("documents") & "/success.jpg"
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
 
Posts: 3794
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN

Re: Can't View Exported Image

Postby Prabhavins » Tue Sep 19, 2017 12:35 pm

Hi,
Thanks for the suggestions.
I am trying to upload profile image and change the profile image image whenever i wish in my app. I am using sqllite database. Can we use any other database?
I am struck with how to resize the large image into specified width and height without loss of quality.

please advise.


Regards,
Prabha
Prabhavins
 
Posts: 5
Joined: Thu Jun 29, 2017 1:00 pm

Re: Can't View Exported Image

Postby Klaus » Tue Sep 19, 2017 3:10 pm

Hi Prabha,

Prabhavins wrote:I am trying to upload profile image and change the profile image image whenever i wish in my app. I am using sqllite database. Can we use any other database?

look up "revopendatabase" in the dictionry to see a list of all LC supported database types.

Prabhavins wrote:I am struck with how to resize the large image into specified width and height without loss of quality.

Do you want to talk about this? Maybe we can help. 8)
Hint: Look up "resizequality" in the dictionary.


Best

Klaus
Klaus
 
Posts: 9488
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany


Return to Android Deployment

Who is online

Users browsing this forum: No registered users and 3 guests

cron