Sending pictures by e-mail to a Drupal site
Dan successfully did this with the mailhandler and mailsave modules.
He'll have to post how. Here's some utterly irrelevant and useless background:
Images with mailhandler... back in 2003!
http://drupal.org/node/2702
I successfully implemented imagehandler.module for Drupal 4.0. Since mailhandler and image module has changed a lot since, you probably need retune the function. It currently supports only JPG.
function imagehandler_mailhandler($node, $stream, $msg_number, $mailbox) {
$image = mailhandler_get_part($stream, $msg_number, "IMAGE/JPEG");
if ($image) {
$node->type = "image";
$node->format = "jpg";
$node->body = mailhandler_get_part($stream, $msg_number, "TEXT/PLAIN");
$node->image_id = md5(rand());
$node->image_name = $node->title.".jpg";
$node->thumb_name = _image_thumbname($node);$dest = fopen(_image_tempname($node),"w");
fputs($dest,$image,strlen($image));
fclose($dest);watchdog("message", "Retreived image $node->image_name from incoming mail");
}
return $node;
}
Also old, but not as old:
mailsave module for drupal
http://www.stuartandnicola.com/node/433
mailhandler images names
Dan successfully did this with the mailhandler and mailsave modules.
He'll have to post how. Here's some utterly irrelevant and useless background:
Images with mailhandler... back in 2003!
http://drupal.org/node/2702
I successfully implemented imagehandler.module for Drupal 4.0. Since mailhandler and image module has changed a lot since, you probably need retune the function. It currently supports only JPG.
function imagehandler_mailhandler($node, $stream, $msg_number, $mailbox) {
$image = mailhandler_get_part($stream, $msg_number, "IMAGE/JPEG");
if ($image) {
$node->type = "image";
$node->format = "jpg";
$node->body = mailhandler_get_part($stream, $msg_number, "TEXT/PLAIN");
$node->image_id = md5(rand());
$node->image_name = $node->title.".jpg";
$node->thumb_name = _image_thumbname($node);$dest = fopen(_image_tempname($node),"w");
fputs($dest,$image,strlen($image));
fclose($dest);watchdog("message", "Retreived image $node->image_name from incoming mail");
}
return $node;
}
Also old, but not as old:
mailsave module for drupal
http://www.stuartandnicola.com/node/433
mailhandler images names
Comments
Post new comment