revTalk - iRev - revWeb - PHP - iPhone and back again

Sarah Reichelt sarah.reichelt at gmail.com
Wed Nov 4 17:26:43 EST 2009


On Wed, Nov 4, 2009 at 11:44 PM, Thomas McGrath III <mcgrath3 at mac.com> 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.

Great work. I too have spent some months struggling with Objective-C.
It's not bad as C goes - at least the IDE is nice to use - but it
seems to take ages to do things which are so easy in Rev...

> 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.

Not quite sure what you have in mind here, but it doesn't sound too difficult.
Did you want a web page that only shows the recent images?
Or a web page that shows the last x images, but updates itself if
there are new ones?

Showing the most recent images is easy enough - you can use standard
Rev commands to list the long files in the images folder and sort by
date to get the new ones.
A web page can be set to refresh periodically by including a REFRESH
meta tag, but this is probably not what you want.

I have a slideshow page that uses AJAX to ask an iRev file for the
html to display next. The iRev file lists the images, picks one
randomly, works out the size so it can construct a valid HTML img tag,
then sends that tag back to the AJAX call. This uses JavaScript to set
the innerHTML of a div tag to show the new image. There is a
JavaScript timer so this happens every 5 seconds.
It sounds worse than it is, but you can see it in action here:
<http://www.troz.net/onrev/samples/slideshow.irev>

What you could do is have an iRev file that just returned true or
false depending on whether there were any new images.
If it returned false, the web page could just set up a new timer and wait.
if it returned true, the web page could ask another iRev file for the
details of the images to display and then display them.


> 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.

Sorry, I haven't done any investigations of the push mechanism yet.
But if your uploading script can trigger an iRev script, I'm sure it
can do whatever is needed to push data.

I would not worry about PHP if I were you. iRev is a good replacement
for server-side scripting which is what PHP does.
You will need some JavaScript if you need any client-side scripting
i.e. timers, reactions to clicks on the web page, AJAX etc.

Please send more detail on what you really need and I'm sure we can
start to work out some scripts.

Cheers,
Sarah



More information about the use-livecode mailing list