Sun Jun 13 10:32:47 EDT 2004

Image Reader for Motorola v300 on tMobile
Charles Severance
csev@umich.edu

You can use this software in any way that you like.  There is no warranty.

To use this, you need a pop account that your v300 can receive your photos.

There are two main files:

NP.php - The script which makes the pop connection andtretrieves the files.

web/index.php - This both displays the thumbnails and does the retrievals.

Since you must embed a pop id/pw into the NP file, it is a good thing not 
to leave it setting around in your web space.  So we addume that you 
have two directories:

/home/bob/htdocs/images  - Part of your web space
/home/bob/htdocs/dev/pop - Not part of your web space

Unpack the distribution into the dv area so that the file is effectively

/home/bob/htdocs/dev/pop/README

Copy the file web/index.php to /home/bob/htdocs/images

Edit the file so that www.dr-chuck.com is not your home page :)

Note that when NP.php runs, it will make directories within image
and copy index.php into those directories.

For example if the first message came on 07/01/2005, you would end up 
with the following directories and files:

/home/bob/htdocs/images/2005
/home/bob/htdocs/images/2005/index.php
/home/bob/htdocs/images/2005/07
/home/bob/htdocs/images/2005/07/index.php

You must edit index.php so it knows the path back to the NP.php - I use 
an absolute path here because I don't know aby better.

You must also edit the NP.php so that it knows the path back to the images
directory.  Perhaps there is a cleaner way to do this, but absolute paths
made my debugging simpler because I don't know much about PHP.

You must also edit NP.php to give it the pop host, pop login and
pop password.

***********************************************************************
Note: This account should only be used for v300 messages.  The software 
silently deletes any message which it does not understand.  It only
understands v300 messages.
***********************************************************************

In the directory is a bunch of PHP helper stuff.  I am not experte in PHP
I just kept installing stuff until things worked!

About now you are ready to test the little fellow.  Send a picture message
to the pop account.  Make sure that it has arrrived and then
call NP.php directly at:

http://myhost.com/dev/NP.php

The output should be:

getNumMsg
1
mimeDecode()
Text part:Testing
-------------------------------------------------------
This message was sent from a T-Mobile wireless phone.
Image Name from c_type = 13-06-04_1026.jpg
Meta file=13-06-04_1026
strlen12Meta file=13-06-04_1026.txt
Array
(
    [0] => 13
    [1] => 06
    [2] => 04
    [3] => 1026.jpg
)
mkdir /home/bob/htdocs/images/2004
mkdir /home/bob/htdocs/images/2004/06
Writing file = /home/bob/htdocs/images/2004/06/13-06-04_1026.jpg
Writing file = /home/bob/htdocs/images/2004/06/13-06-04_1026.txt
Writing file = /home/bob/htdocs/images/../lastblog.jpg
Test-mode Not deleting message 1

Several notes:

Because you are in test mode (see NP.php) the message is not deleted
so you can test over and over again.  Given that it does the same thing
it is perfectly OK to retrieve the same message over and over again.
I even use this to re-send a picture with a better message.  The later
message just overwrites the earlier message.

It writes but the image file and the test portion of the message as a 
bit of metadata with a .txt extension.  The index.php knows all 
of these conventions and behaves appropriately.

Note that it is also writing an image to what it thinks is the
home directory called lastblog.jpg - You can disabe this - I use this
on my top page (www.dr-chuck.com) to change the recent blog picture.
You can just disable that code if you like.

Once NP.php works, it is time to test the auto-call of NP.php
from index.php.

Go to:

http://myhost.com/images/index.php

Because NP.php already ran you should see a subdirectory for the 
year - do a view source and you can see the running of the NP.php
hidden in web comments.

If it appears to be running successfully, edit the NP.php to turn off test 
mode and refresh again.  You should again see the retrieval- and then 
the message will be deleted.  Press refresh again and nothing will 
be retrieved.

Navigate through and make sure that your files (jpg and txt) are getting
to the right locations and that the display/navigation of the images 
works fine.

My to do list includes wanting to have an RSS feed of the most recent 
pictures automatically updated.  It should not be too hard - just re-write 
a feed file on every new picture when something new retrieved.

Sorry if this is more complex than it neede to be - I am just learning PHP
and don't know the tricks.

Charles Severance
www.dr-chuck.com
c.severance@ieee.org
