PageRenderTime 22ms CodeModel.GetById 13ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/framework/vendor/swift/lib/classes/Swift/Image.php

http://zoop.googlecode.com/
PHP | 62 lines | 21 code | 7 blank | 34 comment | 0 complexity | 8732e3a328389f53302fe889d1b61e2a MD5 | raw file
 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 */
20class 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}