Version 0.1.5 of Community Mobile Channels Released
I have released version 0.1.5 alpha of Community Mobile Channels (CMC) - the 3 major changes on this release as detailed below: -
- MMS/email picture upload (requires gmail account and php imap module (usually installed))
- Desktop browser detection and no link to mobilised links from desktop (browser.ini used)
- Several Fixes around private channels and security
The new release is available at http://sourceforge.net/projects/communitymobile/
The demo email upload account is uploadap@gmail.com - send pictures to it and cc robertsallen (at) gmail (dot) com - I will import on request.
I promised to blog around the upload of MMS and this is how it works with version 0.1.5 …
Getting MMS/Email Picture Uploads to work (Simple version)
1. Set up a new gmail account (only use it for uploads)
2. Login to CMC as admin. Click ‘Site Admin’ and ‘Site Options’ - then change the gmail username and password
3. MMS a picture to the gmail account or email a picture to the gmail account
4. Login to CMC as admin. Click ‘Site Admin’ and ‘Import’ - The system will import new pictures into the default channel
5. The image will now be accessible to add to any posts and can be found in ‘Manage Content’ > Pictures
Getting MMS/Email Picture Uploads to work (Techie version)
1. Set up a gmail account (no apologies - gmail has a specific way of dealing with imap that is easy to work with and gmail is fairly simple to get an account for). Only use it for uploads.
2. Either enter gmail accounts directly on the cc_site_details table or login to CMC as admin. Then click ‘Site Admin’ and ‘Site Options’ and change the gmail username and gmail password fields.
3. Send a picture to the gmail account via sms or email or both
4. As admin click ‘Site Admin’ then ‘Import’ then ‘Import email’ - the system will then run import_email.php which
4.1 logs into the gmail account
$imap = imap_open(”{imap.gmail.com:993/imap/ssl/novalidate-cert}INBOX”, $gmail_username, $gmail_password);
4.2 looks for new messages
$current_messageno = imap_num_msg($imap); //gets the number of messages in the inbox
echo “Messages in Inbox : ” . $current_messageno. “<br/>”;
echo “Messages unread : ” . ($current_messageno - $gmail_messageno + 1) .”<br/>”; //$gmail_messageno is the last message read in
while ($current_messageno >= $gmail_messageno) { //while there are still messages that have not been read do the following
4.3 analyses each new message and look for jpg attachments - key code below
$header = imap_header($imap, $xpb);
$info = imap_fetchstructure($imap, $xpb); //get the structure of the email// find out how may parts the object has
$numparts = count($info->parts);// find if if multipart message
if ($numparts > 1) {
$xpc=1; //counter for file part identifer
foreach ($info->parts as $part) {if ($part->disposition == “INLINE”) {
$xpc=$xpc+1;} elseif ($part->disposition == “ATTACHMENT”) { //if the part is an attachment
$xpc=$xpc+1;$strFileName = $part->dparameters[0]->value; //get the file Name
$strFileType = strrev(substr(strrev($strFileName),0,4)); // get the file typeif ($strFileType == “.jpg”) {
echo “Attachment found : “;
// print out the file name
echo “Filename : “, $part->dparameters[0]->value;
4.4 Takes the found jpg and changes it into all the different files sizes
(400px, 276px, 216px, 168px, 120px and standard/cropped thumbnails) - look in the import_email.php file for how this is done (in is the same as standard file uploads)
4.5 adds record of picture to database within default channel -
this is entered in the table cc_channel_content
4.6 repeats from 4.2 until no new messages
5. The images will now be accessible for use in the system
