TYPO3 API  SVNRelease
Image.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  * This file is part of SwiftMailer.
00005  * (c) 2004-2009 Chris Corbyn
00006  *
00007  * For the full copyright and license information, please view the LICENSE
00008  * file that was distributed with this source code.
00009  */
00010 
00011 //@require 'Swift/Image.php';
00012 //@require 'Swift/ByteStream/FileByteStream.php';
00013 
00014 /**
00015  * An image, embedded in a multipart message.
00016  * @package Swift
00017  * @subpackage Mime
00018  * @author Chris Corbyn
00019  */
00020 class Swift_Image extends Swift_EmbeddedFile
00021 {
00022 
00023   /**
00024    * Create a new EmbeddedFile.
00025    * Details may be optionally provided to the constructor.
00026    * @param string|Swift_OutputByteStream $data
00027    * @param string $filename
00028    * @param string $contentType
00029    */
00030   public function __construct($data = null, $filename = null,
00031     $contentType = null)
00032   {
00033     parent::__construct($data, $filename, $contentType);
00034   }
00035 
00036   /**
00037    * Create a new Image.
00038    * @param string|Swift_OutputByteStream $data
00039    * @param string $filename
00040    * @param string $contentType
00041    * @return Swift_Mime_EmbeddedFile
00042    */
00043   public static function newInstance($data = null, $filename = null,
00044     $contentType = null)
00045   {
00046     return new self($data, $filename, $contentType);
00047   }
00048 
00049   /**
00050    * Create a new Image from a filesystem path.
00051    * @param string $path
00052    * @return Swift_Mime_EmbeddedFile
00053    */
00054   public static function fromPath($path)
00055   {
00056     $image = self::newInstance()->setFile(
00057       new Swift_ByteStream_FileByteStream($path)
00058       );
00059     return $image;
00060   }
00061 
00062 }