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: /**
12: * An image, embedded in a multipart message.
13: * @package Swift
14: * @subpackage Mime
15: * @author Chris Corbyn
16: */
17: class Swift_Image extends Swift_EmbeddedFile
18: {
19: /**
20: * Create a new EmbeddedFile.
21: * Details may be optionally provided to the constructor.
22: * @param string|Swift_OutputByteStream $data
23: * @param string $filename
24: * @param string $contentType
25: */
26: public function __construct($data = null, $filename = null, $contentType = null)
27: {
28: parent::__construct($data, $filename, $contentType);
29: }
30:
31: /**
32: * Create a new Image.
33: * @param string|Swift_OutputByteStream $data
34: * @param string $filename
35: * @param string $contentType
36: * @return Swift_Mime_EmbeddedFile
37: */
38: public static function newInstance($data = null, $filename = null, $contentType = null)
39: {
40: return new self($data, $filename, $contentType);
41: }
42:
43: /**
44: * Create a new Image from a filesystem path.
45: * @param string $path
46: * @return Swift_Mime_EmbeddedFile
47: */
48: public static function fromPath($path)
49: {
50: $image = self::newInstance()->setFile(
51: new Swift_ByteStream_FileByteStream($path)
52: );
53:
54: return $image;
55: }
56: }
57: