Closed (won't fix)
Project:
Mailhandler
Version:
4.6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
6 Feb 2004 at 06:36 UTC
Updated:
19 Apr 2006 at 18:27 UTC
is anybody (or has any one been succesful in) creating a hook between the mailhandler module and the image module?
it would turn drupal into a fantastic moblog platform.
cheers
Comments
Comment #1
bruno commentedYes. I have been working on it but put it on hold until I have successfully converted image.module to use the new file API. You may have a look into sandbox/bruno/image-mailhandler. There is a modified mailhandler module there. It needs an updated image module which implements the _mailhandler() hook.
Comment #2
simonaustin commentedbruno, I'm curious about what you have done here. Would it be able to handle file attachments? What would need to be done to get file attachments to work?
I'm interested in this project. I found some code of your originally on kollum.drupal.org. I would like to develop this code to handle file attachments. Please let me know if you have any ideas/comments on how this should be done.
Comment #3
javanaut commentedI have implemented a slightly different approach. I have created a mailhandler hook for the filestore module that handles all attachment types. It is not complete or robust, but I will include it below. I realize that some attachment types warrant special treatment, and the only special treatment that my current implementation gives to images is to append an img tag to the bottom of the node body. Automatic thumbnailing would be a useful addition that the image module could contribute to. Maybe we need some sort of content-type-to-module mapping? For now, I just hard-code image-related behavior if content-type starts with "image".
Here's the code I'm working on (just add to filestore.module):
Please understand that this is not a finished project. Some attachment types require special treatment (i.e. winmail.dat attachments) and there are many one-off scenarios that will run any simple elegant solution. If your goal is a moblog site, then many special cases need to be handled. For example, Cingular (a U.S. wireless carrier) phones don't apparently send the photo as an attachment, but instead link to a web page that would have to be screen-scraped to get the image. There are many such one-off scenarios. Once I've tested this out a bit more and it proves to be robust, I'll submit a patch to the filestore project. Also, this code was developed against 4.4.0rc code. I have no idea what it will do on 4.3.0.
Comment #4
simonaustin commentedmy goal isn't a moblog site, but rather having users be able to email in stories that can have files attached that can be downloaded. I don't even need the images to display. The files just have to be downloadable. I'm running 4.3 so I might need to make some modifications to the code that you supplied. I'll let you know my results.
Comment #5
moshe weitzman commentedsince this issue was opened, we have come a long way with upload.module and image.inc/module. i think now would be a great time to implement this.
Comment #6
javanaut commentedI'm planning on revamping the moblog module's underbelly for 4.6. The current means of creating image and file nodes from mime attachments is admittedly ugly. As far as the moblog platform goes, a generic solution would be quite difficult considering some of the challenges that I've seen with the moblog module:
* Wildly variant message formats, from simple single image attachments to embedded xml linking to remote audio/video/image content.
* Unwanted attachments..when I post content from my own phone, there are spacer.gif's, dotted_line.gif's, etc. that accompany the actual content. There would need to be a means of filtering these out.
There are other challenges as well, but in general, I would prefer the main mime-content-to-node translation to be in a well supported module such as mailhandler (mainly because it could be used by many other modules). I haven't really pushed for developers to support a formalized API for creating nodes from amorphous data, because, in my eyes, the challenge is very large and any solution that I can currently think of would be either a compromise or ugly (or both). Besides, I'm no good at pushing a somewhat political agenda :P
I will put a bit of thought into this as moblog module gets revised for 4.6. In a perfect world (at this point), I would like the mime-to-file and mime-to-image-node code in mailhandler if possible such that simple attachments are handled without needing moblog module. In such a design, moblog module would call upon mailhandler to perform these operations. If further strangeness is required (like pulling files off of a phone carrier's server), this more bizarre code would go in moblog (core is clean, outermost has cruft/implementation-specific stuff). This would allow perfect-world scenarios to be handled without installing moblog, and moblog to use mailhandler for heavy lifting.
Comment #7
moshe weitzman commentedsounds good ... fyi, i did some mime decoding voodoo in upload_indexer.module
Comment #8
sanduhrsThere's a new approach to send images (media) vie e-mail/mobile without any filtering (yet) at http://drupal.org/node/59122 .
It uses image.module and mailhandler.module (patched for 4.7).
Please have a look at it and post your opinion/feedback/suggestions/code.
Tia.
Comment #9
moshe weitzman commentedsee new module described in comment before this one.