Media
in package
FinalYes
A file to upload: a video, a thumbnail, a caption track, a banner.
Uploads go in one request, as multipart/related when there is metadata to
send beside the file and as the bare file when there is not. That suits
thumbnails, banners and captions. A large video is better sent with Google's
resumable protocol, which this library does not implement yet: a single
request holds the whole file in memory and starts over if it fails.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- fromFile() : self
- Reads a file from disk. The read blocks, so do it before the loop is busy, or keep the file small.
- guessMimeType() : string
Properties
$contents read-only
public
string
$contents
$mimeType read-only
public
string
$mimeType
= 'application/octet-stream'
Methods
__construct()
public
__construct(string $contents[, string $mimeType = 'application/octet-stream' ]) : mixed
Parameters
- $contents : string
-
The file's bytes.
- $mimeType : string = 'application/octet-stream'
-
What they are, e.g.
image/pngorvideo/mp4.
fromFile()
Reads a file from disk. The read blocks, so do it before the loop is busy, or keep the file small.
public
static fromFile(string $path[, ?string $mimeType = null ]) : self
Parameters
- $path : string
- $mimeType : ?string = null
Tags
Return values
selfguessMimeType()
private
static guessMimeType(string $path) : string
Parameters
- $path : string