revTalk - iRev - revWeb - PHP - iPhone and back again
Alex Tweedly
alex at tweedly.net
Wed Nov 4 17:20:58 EST 2009
Thomas McGrath III wrote:
> Overview:
> I have been plugging away at writing an iPhone application that
> manipulates photos and uploads them online (why I have been so silent
> on the list for awhile). And except for a major confusion working with
> the internal database (still unresolved) I have been able to get
> everything else working.
>
> What I can do so far is load a view on the iPhone and take a picture
> or use a picture from the camera/library on the iPhone, add a
> background, a frame and some text from a database. I can also edit the
> text in a table and save to a user file in the device. Lastly, I can
> email and SMS the final image to another phone or computer and NOW I
> can send the picture up to rev-online via a 'borrowed' PHP script.
>
When you say "rev-online" I take it you mean on-rev ?
Sarah has an example on her wonderful on-rev samples page (
http://www.troz.net/onrev/ ) of a script to upload pictures.
I'm not clear on how the iPhone sends the pictures via a borrowed PHP
script - but it might be easy to convert this irev script to match it.
(If you like, email me the PHP script and I'll have a look at an iRev
equivalent to it).
> What I would like to do is have either iRev or a revWeb standalone
> 'know' when new images are uploaded and display them in the browser
> for users to see and show. I would also like to have iRev/revWeb send
> out a push notification to another iPhone application (the image
> viewer) so that viewers will know that other users have uploaded new
> pictures. I am studying up on the push notification on the iPhone side.
>
If you can convert the upload mechanism to iRev then you're (almost) done.
If not, you could run a rev script periodically (say one per minute or
once per 10 minutes) to check for the latest pictures, and then update
or push data accordingly. You could do this, as Shao Sean suggested via
a cgi or compiled rev app tun with -ui --- but that would be new
territory for me. You could write an iRev script that checks for new
photos (uploaded since the last time the script ran) and pushes them out
(that's pretty easy). And then you could trigger that script
periodically, using a cron job with curl.
(cron is simply a Unix mechanism to run the same command line app or
command at regular intervals, such as every so many minutes or hours (or
days, months, ...))
To do this, go into cPanel, click on "cron jobs" in the "Advanced"
section. Then click on "standard" for experience level, and fill in the
(pretty obvious) values, with the "command to run:" line being
curl http://www.mysitename.com/myscript.irev
-- Alex.
More information about the use-livecode
mailing list