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