/** * * */ function __toString() { // Resolve the content disposition as per RFC 2183 if (arr::hasKey($this->options, 'inline') && $this->options['inline'] == true) { $disposition = 'inline'; } else { $disposition = 'attachment; filename="' . basename($this->filename) . '"'; } // Assemble the headers $headers = array('Content-Type' => response::contentTypeFromFile($this->filename), 'Content-Transfer-Encoding' => 'base64', 'Content-Disposition' => $disposition); if (arr::hasKey($this->options, 'contentid')) { $headers['Content-ID'] = $this->options['contentid']; } $headersstr = ''; $content = chunk_split(base64_encode(file_get_contents($this->filename))); foreach ($headers as $k => $v) { $headersstr .= $k . ': ' . $v . "\r\n"; } return $headersstr . "\r\n" . $content . "\r\n"; }