Added feature #15998: Create a new API to send mails based on SwiftMailer to replace...
[Packages/TYPO3.CMS.git] / typo3 / contrib / swiftmailer / classes / Swift / Image.php
1 <?php
2
3 /*
4 * This file is part of SwiftMailer.
5 * (c) 2004-2009 Chris Corbyn
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11 //@require 'Swift/Image.php';
12 //@require 'Swift/ByteStream/FileByteStream.php';
13
14 /**
15 * An image, embedded in a multipart message.
16 * @package Swift
17 * @subpackage Mime
18 * @author Chris Corbyn
19 */
20 class Swift_Image extends Swift_EmbeddedFile
21 {
22
23 /**
24 * Create a new EmbeddedFile.
25 * Details may be optionally provided to the constructor.
26 * @param string|Swift_OutputByteStream $data
27 * @param string $filename
28 * @param string $contentType
29 */
30 public function __construct($data = null, $filename = null,
31 $contentType = null)
32 {
33 parent::__construct($data, $filename, $contentType);
34 }
35
36 /**
37 * Create a new Image.
38 * @param string|Swift_OutputByteStream $data
39 * @param string $filename
40 * @param string $contentType
41 * @return Swift_Mime_EmbeddedFile
42 */
43 public static function newInstance($data = null, $filename = null,
44 $contentType = null)
45 {
46 return new self($data, $filename, $contentType);
47 }
48
49 /**
50 * Create a new Image from a filesystem path.
51 * @param string $path
52 * @return Swift_Mime_EmbeddedFile
53 */
54 public static function fromPath($path)
55 {
56 $image = self::newInstance()->setFile(
57 new Swift_ByteStream_FileByteStream($path)
58 );
59 return $image;
60 }
61
62 }