lib/Doctrine/CouchDB/Attachment.php
public static function createFromBinaryData($data, $contentType = false)
    {
        if (\is_resource($data)) {
            $data = \stream_get_contents($data);
        }

        return new self($data, \base64_encode($data), $contentType);
    }
public static function createFromBinaryData($data, $contentType = false)
    {
        if (\is_resource($data)) {
            $data = \stream_get_contents($data);
        }

        return new self($data, \base64_encode($data), $contentType);
    }
public static function createFromBinaryData ( $ data , $ contentType = false ) { if ( \ is_resource ( $ data ) ) { $ data = \ stream_get_contents ( $ data ) ; } return new self ( $ data , \ base64_encode ( $ data ) , $ contentType ) ; }
Create an Attachment from a string or resource of binary data.

WARNING: Changes to the file handle after calling this method will *NOT* be recognized anymore.

@param string|resource $data
@param string          $contentType

@return Attachment
Create an Attachment from a string or resource of binary data .