public function MailMIME::addHTMLImage in Mail MIME 7
Same name and namespace in other branches
- 8.2 mailmime.inc \MailMIME::addHTMLImage()
 - 6.2 mailmime.inc \MailMIME::addHTMLImage()
 - 6 mailmime.inc \MailMIME::addHTMLImage()
 - 7.2 mailmime.inc \MailMIME::addHTMLImage()
 
Adds an image to the list of embedded images.
Parameters
$file: The image file name OR image data itself.
$content_type: (optional) The content-type of the image, such as "image/gif".
$name: (optional) The filename of the image, if $is_file is FALSE.
bool $is_file: (optional) FALSE if $file contains the actual image data, rather than a filename. Defaults to TRUE.
$content_id: (optional) The desired Content-ID for this MIME part.
Return value
TRUE if the file was successfully attached, and FALSE if it wasn't.
1 call to MailMIME::addHTMLImage()
- MailMIME::attachRegex in ./
mailmime.inc  - A preg_replace_callback used to attach local files, if possible.
 
File
- ./
mailmime.inc, line 231  - Provides the MailMIME class for creating MIME-formatted email messages.
 
Class
- MailMIME
 - The MailMIME class is used to create MIME email messages.
 
Code
public function addHTMLImage($file, $content_type = NULL, $name = '', $is_file = TRUE, $content_id = NULL) {
  if (empty($content_id)) {
    $content_id = md5($is_file ? $file : $name);
  }
  if (!isset($this->cids[$content_id])) {
    // @todo set $content_type with mimedetect if possible.
    $this->cids[$content_id] = MailMIME::successful(parent::addHTMLImage($file, $content_type, $name, $is_file, $content_id));
  }
  return $this->cids[$content_id];
}