Uploading photo from library and storing in the iPhone app.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 10
- Joined: Fri Feb 07, 2014 10:57 am
Uploading photo from library and storing in the iPhone app.
Hi,
I am having some trouble figuring out how to store a photo within the app on an iPhone after it has been uploaded from the photo library.
What I am trying to do is upload an image to an app as a thumbnail size (this I have managed to do). However what I would then like to do is have that image enlarge to full screen when it is pressed and remain in the app after it has been shut down.
Any help would be extremely grateful.
Many thanks
Chris
I am having some trouble figuring out how to store a photo within the app on an iPhone after it has been uploaded from the photo library.
What I am trying to do is upload an image to an app as a thumbnail size (this I have managed to do). However what I would then like to do is have that image enlarge to full screen when it is pressed and remain in the app after it has been shut down.
Any help would be extremely grateful.
Many thanks
Chris
-
- VIP Livecode Opensource Backer
- Posts: 369
- Joined: Sun Dec 19, 2010 1:10 am
- Location: UK
- Contact:
Re: Uploading photo from library and storing in the iPhone a
Hi, Chris.
For the app to remember the image after it's shut down, you can save app info in text files, databases, etc. I've used a few different save / load ideas in mobile apps - here's one that's really quick and works pretty well.
Global app data is stored in a global array - gAppA. Once an image is selected, you could;
When the app starts the next time, you can read the saved data back into the global array and do whatever needs done with it;
HTH
Are you uploading the image to a server to download on other devices? Or just selecting an image from the gallery? If you need the large image, then just uploading the large image and creating the thumbnail from that as required may be the easiest way - or you could create the thumbnail from the large image and upload both - or create the thumbnail on the server!What I am trying to do is upload an image to an app as a thumbnail size
For the app to remember the image after it's shut down, you can save app info in text files, databases, etc. I've used a few different save / load ideas in mobile apps - here's one that's really quick and works pretty well.
Code: Select all
command saveAppData
set the folder to specialFolderPath("Documents")
put arrayEncode(gAppA) into URL("binfile:app.cfg")
end saveAppData
command getAppData
try
set the folder to specialFolderPath("Documents")
put arrayDecode(URL("binfile:app.cfg")) into gAppA
catch tError
end try
end getAppData
Code: Select all
put tImageName into gAppA["SavedImage"]
saveAppData
Code: Select all
getAppData
answer "Saved image = " & gAppA["SavedImage"]
HTH
LiveCode Development & Training : http://splash21.com
Re: Uploading photo from library and storing in the iPhone a
Hi Chris,
Your question isn't entirely clear. You can't upload something from something and the photo library has nothing to do with up- and downloading. Also, you don't upload an image to an app. You can, however, upload an image to a server. Also, it isn't clear whether you have been able to import (as it is called) an image from the photo library. How far exactly did you get with this?
It seems you want to be able to store a picture file and keep it available between sessions. Assuming that you have created an image control "My Picture" to display the file, you can do the following:
You can put the first 2 lines into a closeStack handler and the second 2 lines into a preOpenStack handler.
Kind regards,
Mark
Your question isn't entirely clear. You can't upload something from something and the photo library has nothing to do with up- and downloading. Also, you don't upload an image to an app. You can, however, upload an image to a server. Also, it isn't clear whether you have been able to import (as it is called) an image from the photo library. How far exactly did you get with this?
It seems you want to be able to store a picture file and keep it available between sessions. Assuming that you have created an image control "My Picture" to display the file, you can do the following:
Code: Select all
// save file
put specialFolderpath("documents") & "/picture.pic" into myPath
put the text of img "My Picture" into url ("binfile:" & myPath)
// display the picture again
put specialFolderpath("documents") & "/picture.pic" into myPath
put url ("binfile:" & myPath) into img "My Picture"
Kind regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 9833
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Uploading photo from library and storing in the iPhone a
Moderation note: A duplicate of this thread in another forum section was merged here.
In the future please post a given question only once so we can keep all the replies together to help those who find this topic valuable, as recommended in the "Suggestions for Posting" section of the Forum Guidelines: http://forums.runrev.com/phpBB2/viewtop ... =4&t=18885
Thanks.
In the future please post a given question only once so we can keep all the replies together to help those who find this topic valuable, as recommended in the "Suggestions for Posting" section of the Forum Guidelines: http://forums.runrev.com/phpBB2/viewtop ... =4&t=18885
Thanks.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Uploading photo from library and storing in the iPhone a
Thanks Richard, "Merge topic", why didn't I discover this until now?
-
- Posts: 10
- Joined: Fri Feb 07, 2014 10:57 am
Re: Uploading photo from library and storing in the iPhone a
Hi,
Thank you for the replies.
I apologise for posting the question in two separate topics.
I have been able to import and image from the iphone photo library and resize this to what ever size I decide. What I am trying to do next is store the photo in the app after everything has been closed down and be able to make the image fill the screen when it is pressed.
At present I import the photo and it shows on the screen as a thumbnail (which I have set it to do). I now want to be able to press the thumbnail and make the image fullscreen, whilst keeping it in the app.
Many thanks
Chris
Thank you for the replies.
I apologise for posting the question in two separate topics.
I have been able to import and image from the iphone photo library and resize this to what ever size I decide. What I am trying to do next is store the photo in the app after everything has been closed down and be able to make the image fill the screen when it is pressed.
At present I import the photo and it shows on the screen as a thumbnail (which I have set it to do). I now want to be able to press the thumbnail and make the image fullscreen, whilst keeping it in the app.
Many thanks
Chris
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Uploading photo from library and storing in the iPhone a
Hi Chris,
I'm not sure where the subject line of your post comes into this, "Uploading photo..." as your questions don't seem related to uploading. Normally we talk about uploading something when we upload a file to a server.
I'm going to ignore that for now and work on the above question.
You will have to store the image in the specialFolderPath("documents") folder. Do you know how to do that?
The full screen image?
I'm guessing you are using "lock size and position" for your thumbnails, is that true?
If it is, then just unlock them.
Add more information if I have this all wrong. Which I often do
Simon
I'm not sure where the subject line of your post comes into this, "Uploading photo..." as your questions don't seem related to uploading. Normally we talk about uploading something when we upload a file to a server.
I'm going to ignore that for now and work on the above question.
You will have to store the image in the specialFolderPath("documents") folder. Do you know how to do that?
The full screen image?
I'm guessing you are using "lock size and position" for your thumbnails, is that true?
If it is, then just unlock them.
Add more information if I have this all wrong. Which I often do
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 10
- Joined: Fri Feb 07, 2014 10:57 am
Re: Uploading photo from library and storing in the iPhone a
Hi Simon,
Yeah it is not uploading - I am trying to import an image from my iPhone library.
So far I have created the buttons that import an image from the library using this code:
However, I can't seem to figure out how to keep the image in the app after it has closed and make the image a clickable so it becomes full size.
What I have so far is a row of 10 buttons that are set to a lockable size - these buttons all have the above code to import the photo from the iPhone library.
What I want is for all the photos that have been imported to be saved in the app at the import (72x72) size but also be able to make the image fullscreen if pressed.
Thank you for your help
Chris
Yeah it is not uploading - I am trying to import an image from my iPhone library.
So far I have created the buttons that import an image from the library using this code:
Code: Select all
on mouseUp
set the lockloc of the templateimage to true
set the width of the templateimage to "72"
set the height of the templateimage to "72"
set the left of the templateimage to "32"
set the top of the templateimage to "135"
mobilePickPhoto "library"
if the result is empty then
end if
end mouseUp
What I have so far is a row of 10 buttons that are set to a lockable size - these buttons all have the above code to import the photo from the iPhone library.
What I want is for all the photos that have been imported to be saved in the app at the import (72x72) size but also be able to make the image fullscreen if pressed.
Thank you for your help
Chris
Re: Uploading photo from library and storing in the iPhone a
Chris,
As I and Simon tried to explain before, you "upload" to a server. Why do you reply "it is not uploading"? What exactly do you mean by that?
I'll have another look at your code later, if Simon isn't quicker than me
Mark
As I and Simon tried to explain before, you "upload" to a server. Why do you reply "it is not uploading"? What exactly do you mean by that?
I'll have another look at your code later, if Simon isn't quicker than me
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Uploading photo from library and storing in the iPhone a
Hi Chris,
You'll not actually be saving the picture at thumbnail size but full size.
Here is the lesson on saving files on mobile:
http://lessons.runrev.com/s/lessons/m/4 ... -on-mobile
By setting that 72x72 you lock the image size but not the actual image, it's still the same size it always was.
Simon
You'll not actually be saving the picture at thumbnail size but full size.
Here is the lesson on saving files on mobile:
http://lessons.runrev.com/s/lessons/m/4 ... -on-mobile
By setting that 72x72 you lock the image size but not the actual image, it's still the same size it always was.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 10
- Joined: Fri Feb 07, 2014 10:57 am
Re: Uploading photo from library and storing in the iPhone a
Hi Simon,
I understand that I have not used the correct terminology and this is possibly where I am getting confused.
I am not sure if the lesson you mentioned is what I need???
I have got to the stage where I am able to import a photo from the iPhone library. The import is set at 72x72 which I understand is not saved at this resolution. The only reason it is set at this size is so it is comparable with the rest of the app.
What I want to be able to achieve next is:
1. Keep the photo within the app at 72x72 when it is closed
2. Have the 72x72 photo resize to 320x568 when it is touched - not sure what I do to make this happen
3. Have an option to clear the screen of 320x568 photo and revert back to the Card with the photo set at 72x72
Thank you
Chris
I understand that I have not used the correct terminology and this is possibly where I am getting confused.
I am not sure if the lesson you mentioned is what I need???
I have got to the stage where I am able to import a photo from the iPhone library. The import is set at 72x72 which I understand is not saved at this resolution. The only reason it is set at this size is so it is comparable with the rest of the app.
What I want to be able to achieve next is:
1. Keep the photo within the app at 72x72 when it is closed
2. Have the 72x72 photo resize to 320x568 when it is touched - not sure what I do to make this happen
3. Have an option to clear the screen of 320x568 photo and revert back to the Card with the photo set at 72x72
Thank you
Chris
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Uploading photo from library and storing in the iPhone a
Hi Chris,
Oh, I see, the image is on the phone so why save it again, I get it, I was thinking about the server stuff.
In the server method one would download the image and save it to a local folder. Your question is when your app opens, how to get the previously added image back into your stack without saving it into a different folder.
Is the above what you are thinking?
That one I don't know. I don't know if there is a programmable path to the gallery.
The lesson I pointed to gives you a known method of retrieving the image.
Simon
Oh, I see, the image is on the phone so why save it again, I get it, I was thinking about the server stuff.
In the server method one would download the image and save it to a local folder. Your question is when your app opens, how to get the previously added image back into your stack without saving it into a different folder.
Is the above what you are thinking?
That one I don't know. I don't know if there is a programmable path to the gallery.
The lesson I pointed to gives you a known method of retrieving the image.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 10
- Joined: Fri Feb 07, 2014 10:57 am
Re: Uploading photo from library and storing in the iPhone a
Hi Simon,
I didn't understand what that lesson was trying to do.
I don't know what to edit as the code in the lesson is based on a text file, nor do I know where to input the code.
If I'm honest I don't know if what I am trying to do is even possible. I have created a row of buttons with a code that picks a photo from the iPhone library and resizes the photo to 72x72 (which is the same as the button)
All I want to be able to do is save the 72x72 photo within the stack and be able to resize the image to a larger size if clicked.
Basically I want it to look like the iPhone photo library - where you have thumbnails and you click each on the make the photo full screen.
Thanks
Chris
I didn't understand what that lesson was trying to do.
I don't know what to edit as the code in the lesson is based on a text file, nor do I know where to input the code.
If I'm honest I don't know if what I am trying to do is even possible. I have created a row of buttons with a code that picks a photo from the iPhone library and resizes the photo to 72x72 (which is the same as the button)
All I want to be able to do is save the 72x72 photo within the stack and be able to resize the image to a larger size if clicked.
Basically I want it to look like the iPhone photo library - where you have thumbnails and you click each on the make the photo full screen.
Thanks
Chris
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Uploading photo from library and storing in the iPhone a
Hi Chris,
What you are trying to do is possible, my thoughts were that you'd save it to a know location "documents". Text file or photo doesn't matter. The lesson was to show how/where to save the file you have.
Just to clear something, an app cannot save anything to itself and data must be stored elsewhere. Apps are fixed but that doesn't mean they can't change depending on what data (in a folder) they have.
Simon
What you are trying to do is possible, my thoughts were that you'd save it to a know location "documents". Text file or photo doesn't matter. The lesson was to show how/where to save the file you have.
The 72x72 image is not really an issue as you just forced an image into a smaller box, the file itself is at the resolution it was originally taken at.and resizes the photo to 72x72
Just to clear something, an app cannot save anything to itself and data must be stored elsewhere. Apps are fixed but that doesn't mean they can't change depending on what data (in a folder) they have.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!