email / mobile phone upload script

wlloydda

Joined: 2006-08-15
Posts: 7
Posted: Wed, 2006-11-22 03:15

Here's a self-contained, PHP script that retrieves images from an email account and then uses the G2 API to upload them to a gallery.

Possible limitations:

- You have to have an email account, but it works with gmail, so that's not really a limitation

- It has some simple security, in that it will only accept an email from an email address that you have previously entered into the script

- You need the PEAR libraries that are specified near the top of the script, they usually come with PHP, so you may already have them

Get them from:

http://pear.php.net/

- Your PHP interpreter has to have SSL support compiled in to it
(for some Windows versions of PHP, you can enable SSL by replacing your php4ts.dll with the correct version from here:

http://ftp.proventum.net/pub/php/win32/misc/openssl/

be sure your php_openssl.dll is commented out in php.ini if you use this and you may need to install OpenSSL and copy the OpenSSL dlls to \Windows\system32)

- Each email can contain multiple images, but only JPG images are supported in this version, if requested, I can add support for other image types

- You MUST have an external user in the g2_externalidmap table, something like: 1,"Album User",6 (6 is usually 'admin' so you can upload to any album)

- The script only uploads to one album, that you have specified by album ID number, in the script

- File names are the email date and time plus some random crap to make it unique

- The Title can be the email date or subject

- The Summary is the mailed from address

Installation:
- Download emmobupld.zip, unzip, and put it in your $gallery_basedir
- Edit the USER CONFIGURATION items in the script
- Add a cronjob that will tickle the php script every 5-15 minutes.
- You MUST have an external user in the g2_externalidmap table

Get it here:

http://www.toaofdarkness.idlegames.net/downloads/emmobupld.zip

- Will

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-11-22 14:51

Nice :)

FYI: topic moved to the appropriate forum.

btw: did you see that there's another user contributed "add via email" module?
http://gallery-contrib.svn.sourceforge.net/viewvc/gallery-contrib/trunk/gallery2/modules/addviaemail/

once we're considering to move them into the main repository, we'll probably merge the two modules into one.

and please don't forget to add your module to documentation -> user contributions -> modules.

 
wlloydda

Joined: 2006-08-15
Posts: 7
Posted: Thu, 2006-11-23 03:24

@valiant

I tried to install the addviaemail module. Everything went OK until I clicked on the Configure button and it jumped to the Gallery Plugins page. All of the "configure | uninstall | delete" links were dead and Add via Email didn't have an "activate | uninstall | delete" link so I stopped before I broke something.

These are the files that I installed. Since some of the "common" files weren't included in the original Gallery v2.1.2 package that I installed, I assume they are for a newer version.

Installed 11-22-06

/PHP/gallery2/modules/core/AdminPlugins.inc - new
/PHP/gallery2/modules/core/PluginCallback.inc - new

/PHP/gallery2/modules/core/templates/AdminPlugins.js - new
/PHP/gallery2/modules/core/templates/AdminPluginsLegend.tpl -new
/PHP/gallery2/modules/core/templates/AdminPlugins.tpl - new

/PHP/gallery2/modules/addviaemail/ - new
/PHP/gallery2/modules/addviaemail/Addviaemail.inc - new
/PHP/gallery2/modules/addviaemail/Callbacks.inc - new
/PHP/gallery2/modules/addviaemail/Configure.inc - new
/PHP/gallery2/modules/addviaemail/HISTORY.txt - new
/PHP/gallery2/modules/addviaemail/MANIFEST.txt - new
/PHP/gallery2/modules/addviaemail/module.inc - new
/PHP/gallery2/modules/addviaemail/README.txt - new

/PHP/gallery2/modules/addviaemail/classes/ - new
/PHP/gallery2/modules/addviaemail/classes/AddviaemailHelper.class - new
/PHP/gallery2/modules/addviaemail/classes/ImageUploadHelper.class - new
/PHP/gallery2/modules/addviaemail/classes/Maps.inc - new
/PHP/gallery2/modules/addviaemail/classes/Maps.xml - new
/PHP/gallery2/modules/addviaemail/classes/GalleryStorage - new
/PHP/gallery2/modules/addviaemail/classes/GalleryStorage/schema.tpl - new

/PHP/gallery2/modules/addviaemail/templates/ - new
/PHP/gallery2/modules/addviaemail/templates/Addviaemail.tpl - new
/PHP/gallery2/modules/addviaemail/templates/Configure.tpl - new

/PHP/gallery2/modules/addviaemail/templates/blocks/ - new
/PHP/gallery2/modules/addviaemail/templates/blocks/AddviaEmail.tpl - new
/PHP/gallery2/modules/addviaemail/templates/blocks/blocks.inc - new

I'll have to look into this "and please don't forget to add your module to documentation -> user contributions -> modules." because I'm not sure if this is a "Module" or just a "Utility."

- Will

 
mrvegas

Joined: 2006-04-28
Posts: 3
Posted: Wed, 2007-06-20 22:38

Hello,
Im a newb at this and would really like to get this script going.
can someone please help me create an external user in the g2_externalidmap table?

I have no idea how to do this and would like to install this.

Matthew