ryan Posted February 27, 2013 Share Posted February 27, 2013 Send photos from your mobile phone to ProcessWire, from anywhere, on-the-fly. ProcessWire maintains a chronological gallery that you can simply email photos to. Works with any e-mail capable device, whether mobile phone, tablet or desktop. Written by Horst Nogajski and Ryan Cramer Output inspired by the work of Philipp Reiner. Discussion leading to this module can be found here. Uses email libraries by Manuel Lemos Requires ProcessWire 2.2.13 or newer Here is example output from this module. Download from GitHub or Download ZIP file How to Install Setup a new email address at your provider. This address should be dedicated to the purpose of this module. Make the address private and cryptic enough so as not to be obvious or discoverable by others. Place the files included with this module in /site/modules/EmailImage/ In your admin, go to Modules > Check for new modules. Click Install for the EmailImage module. Complete all the settings it asks for, per the email you setup in step 1. Check the box to test your connection, and save. How to Use Email an image to the address you configured. You can include multiple images if you like. After waiting a minute or two, view the URL /email-images/ in your site. This is a page that was installed for you to display images. Repeat and enjoy. How to Customize While this module has everything working out-of-the-box, it is meant to be customized to your needs. For example: You may want to move or rename the /email-images/ page somewhere else. The EmailImage module keeps track of this page ID, so it is perfectly fine to remove or rename it if you want to. Take a look at the /site/templates/email-images.php template file. You may wish to replace it entirely with your own code, or you might build upon what's there, or use it as-is. But chances are you'll at least want to swap in your own header/footer to fit within your site's design. Take a look at /site/modules/EmailImage/EmailImageRender.php. That file contains an example function used to render an image gallery. This is the one called upon by the template file you just looked at. You might copy and paste this function somewhere else into your own site, and modify it to suite your own markup needs. Just remember to name it something different! Please post links to what you create in this thread. How to Uninstall You can uninstall this module in the same way as any other module, by checking the box to "uninstall" from the module settings screen. But please note the following warning: When you uninstall, your system is returned to the state that it was in before this module was installed. Meaning, the EmailImage pages and images will be deleted. So please backup your images somewhere else if you want to lose them during uninstall. After uninstalling, you can safely remove this dir: /site/modules/EmailImage/, and you can remove the template file: /site/templates/email-images.php. 15 Link to comment Share on other sites More sharing options...
Joss Posted February 27, 2013 Share Posted February 27, 2013 Oh, very clever! (I cant test it because my mobile does not take photos and cant email either!) 1 Link to comment Share on other sites More sharing options...
pwired Posted February 27, 2013 Share Posted February 27, 2013 Thanks Horst, Ryan and Philipp. Great module added to the repository. Processwire - connecting people. Link to comment Share on other sites More sharing options...
ryan Posted February 27, 2013 Author Share Posted February 27, 2013 (I cant test it because my mobile does not take photos and cant email either!) We say "mobile" because that's the area where this module is most likely to be useful. However, the module doesn't care what device or computer you email photos from. Aren't you inheriting an iPhone 3g pretty soon? Link to comment Share on other sites More sharing options...
Joss Posted February 27, 2013 Share Posted February 27, 2013 In theory - but I am not sure when! I still miss my old sony Z5 I was just thinking, would it be possible to add a bit that defines a gallery? So you would create two - one with the "name" myphoto, and the other morephotos and then on the email, immediately after an image, put either myphoto or morephotos. The script reads that and accesses the right page. If nothing is put (or it does not relate to a known gallery) it goes to which ever is the default. EDIT: you could extend that for adding a caption too. caption: my caption Link to comment Share on other sites More sharing options...
renobird Posted February 27, 2013 Share Posted February 27, 2013 This is brilliant! Is there any way to make it only process emails that come from a particular account, or a whitelist of accounts? I have some potential uses here, but security is a huge issue—just having the address be obscure may not pass the litmus test of my scrutinizers. Well done all. This is very cool. Link to comment Share on other sites More sharing options...
SiNNuT Posted February 27, 2013 Share Posted February 27, 2013 Great module! You guys definately are not like Moose the Cat.. Link to comment Share on other sites More sharing options...
ryan Posted February 27, 2013 Author Share Posted February 27, 2013 Yes, you can definitely whitelist email addresses, and we highly recommend you do. The module configuration screen has a section where you can enter what email address are allowed to post. Keep in mind though that email addresses can be faked, so it's not a guarantee. Though I didn't specifically work with this part and Horst can provide better guidance on that. 1 Link to comment Share on other sites More sharing options...
renobird Posted February 27, 2013 Share Posted February 27, 2013 Hi Ryan, that's great. I'll test it out later today. Link to comment Share on other sites More sharing options...
MarcC Posted February 27, 2013 Share Posted February 27, 2013 Nice, Ryan! Love the demo page too. About a year ago I hired a friend to write something like this--it's actually a script run via cron. It uses an email whitelist, and our local police department uses it to post press releases, daily logs, and other items to their website (I think it's like 3 or 4 separate addresses they can send to). Link to comment Share on other sites More sharing options...
Nico Knoll Posted February 27, 2013 Share Posted February 27, 2013 Would be lovely if something like this would be possible as well: --- name: test-article-123 --- body: Eros euismod, lectus alias. Voluptatum, vitae, gravida. Blanditiis, soluta fugiat platea donec! Suscipit augue lacinia mauris illo anim suscipit euismod quaerat egestas felis autem aenean sem tristique labore cras veniam integer dui eu quisque praesentium phasellus do aperiam dolores, amet, aliquet pariatur a litora sequi ipsum pariatur conubia! Voluptate deleniti, id scelerisque fusce vestibulum ab? Nemo harum condimentum posuere voluptatum. --- somefield: a value --- Link to comment Share on other sites More sharing options...
MatthewSchenker Posted February 27, 2013 Share Posted February 27, 2013 Greetings, Thanks Ryan! This opens the door to some ideas that have come up in various forum discussions... With this module, it seems we are getting close to being able to create pages of any kind by sending an e-mail with the right bits to our ProcessWire installation. Maybe along with each site, we could create e-mail templates with reserved spots like <<title>>, <<name>>, <<body>> and other fields. Then (if I am on the right track) we just need a way to pick up whatever is in those reserved bits as variables in the page-creation process! I've been using the ProcessWire API to create pages and this seems like a potential extension of that process. Thanks, Matthew Link to comment Share on other sites More sharing options...
Soma Posted February 27, 2013 Share Posted February 27, 2013 Cool now I can finally use outlook to build websites. 6 Link to comment Share on other sites More sharing options...
MarcC Posted February 27, 2013 Share Posted February 27, 2013 "Why did that weird image get posted to my web page???" "That must be your Outlook stationery background." 2 Link to comment Share on other sites More sharing options...
ryan Posted February 27, 2013 Author Share Posted February 27, 2013 I think that a module like this mainly provides value in sending a mobile photo to a web site. The reason for that is that many of these mobile phones have no file-upload capability (at least iOS doesn't). But they can send email. So this module actually solves a need and lets you do something you can't otherwise do. Phillip identified the need and solved it by using Tumblr as an intermediary (since their app will pass through photos), which was a great idea. This module solves the need by using email as the intermediary--the one common thing available to all smart phones (and all credit to Horst and Phillip for the ideas). When we get into specifying other types of data and fields, like what's been mentioned above, it definitely sounds cool and interesting. But the reality is, we don't need email for that… we could just login to ProcessWire. We need email only because mobile phones can't upload files. I don't personally have a need to populate text fields from emails, but it's feasible someone could (like some of the things MarcC mentioned, for example). For that need, I think the approach taken in this module would be a good way to go, and perhaps this module could serve as a good starting point to build that capability, for anyone interested. 4 Link to comment Share on other sites More sharing options...
MarcC Posted February 27, 2013 Share Posted February 27, 2013 Great points, Ryan. If there's one thing I learned from testing this with office staff, it's that you don't want to add too many features to an email-to-post setup. The "posting press releases" functionality we added was for attached documents only--should have clarified that. (Edit: Although getting a return email receipt with a link to edit the page is cool too) Link to comment Share on other sites More sharing options...
Marty Walker Posted February 27, 2013 Share Posted February 27, 2013 Very cool! Link to comment Share on other sites More sharing options...
Jason Posted May 11, 2013 Share Posted May 11, 2013 Hello all! Getting to know Processwire and really liking it thus far. Running into some trouble with this module (I'm thinking it's more of a PHP thing). I'm using Servint as my host. Receiving the following error on /email-images/ : Error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 4903304 bytes) (line 319 of /home/biggame/public_html/site/modules/EmailImage-master/EmailImageAdaptor.php) This error message was shown because you are logged in as a Superuser. Error has been logged. Thanks, Jason Link to comment Share on other sites More sharing options...
ryan Posted May 14, 2013 Author Share Posted May 14, 2013 I think that you need to increase your memory size to PHP. Especially for anything that deals with images. I'm guessing you've got it set to 16m or 32m right now. And you probably want to bump it up to 128m or better yet 256m. You can set this in the php.ini via the memory_limit directive. On a ServInt server, I believe this is located in the file /usr/local/lib/php.ini. You'll have to restart Apache after making the change to php.ini. Link to comment Share on other sites More sharing options...
horst Posted May 14, 2013 Share Posted May 14, 2013 Hi Jason, as Ryan already said, there is not enough memory for PHP. And for those who are on a shared (Apache)-server and have no access to a php.ini file: you can try to set this line into the (root) .htaccess file: php_value memory_limit 256M or if this won't work: php_value memory_limit 128M 1 Link to comment Share on other sites More sharing options...
Jason Posted May 14, 2013 Share Posted May 14, 2013 Fantastic, thanks guys, will do! -Jason Link to comment Share on other sites More sharing options...
Jason Posted May 14, 2013 Share Posted May 14, 2013 It worked, thanks again! -Jason Link to comment Share on other sites More sharing options...
globi Posted August 30, 2013 Share Posted August 30, 2013 Hallo!I've just tried the module and it's working like a charm.The problem is that I'm expecting the email entries from more than one user and I need to know who sent the email...?Is there a way to identify the sender somehow? Please advise. Best regards,Mick Link to comment Share on other sites More sharing options...
horst Posted September 1, 2013 Share Posted September 1, 2013 Hi Mick, i have done the pop3 stuff of the module but I don't know how to do the whole story of your question. But maybe there is help with some kind of dirty hack: The sender is identified as $from and to get it out there and into a pw page you may set it into the $BodyText (like e.g. $BodyText = "<|$from|>\n"). This way you later can extract it from the page body once the page is created. Or you may look into the modules file if there is a way to hook into it somewhere before the page get created.btw: Do you know that there is also another module Process Email to Page. Maybe it supports what you need out of the box. (I don't know it, but there is a real chance it could be) 2 Link to comment Share on other sites More sharing options...
Christophe Posted March 14, 2018 Share Posted March 14, 2018 Hi, Can this module work with ProcessWire versions newer than 2.6? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now