Page 1 of 1
Can't View Exported Image
Posted: Mon Sep 11, 2017 1:03 pm
by Prabhavins
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
Re: Can't View Exported Image
Posted: Mon Sep 11, 2017 1:08 pm
by Klaus
Hi Anbu,
welcome to the forum!
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
Re: Can't View Exported Image
Posted: Mon Sep 11, 2017 1:23 pm
by Prabhavins
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
Re: Can't View Exported Image
Posted: Mon Sep 11, 2017 2:08 pm
by Klaus
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
Re: Can't View Exported Image
Posted: Mon Sep 11, 2017 3:32 pm
by Prabhavins
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
Re: Can't View Exported Image
Posted: Mon Sep 11, 2017 4:30 pm
by Klaus
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!
Re: Can't View Exported Image
Posted: Tue Sep 12, 2017 12:20 am
by quailcreek
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
Re: Can't View Exported Image
Posted: Tue Sep 12, 2017 5:30 pm
by jacque
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"
Re: Can't View Exported Image
Posted: Wed Sep 13, 2017 5:58 am
by Prabhavins
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
Re: Can't View Exported Image
Posted: Wed Sep 13, 2017 4:27 pm
by jacque
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"
Re: Can't View Exported Image
Posted: Tue Sep 19, 2017 12:35 pm
by Prabhavins
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
Re: Can't View Exported Image
Posted: Tue Sep 19, 2017 3:10 pm
by Klaus
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.
Hint: Look up "resizequality" in the dictionary.
Best
Klaus