PHP-dataURI API
Class

DataURI\Data

class Data

DataURI\Data object is a representation of an url which embed (small) media type data directly inline.

It owns three main properties :
the data, the type of the media and some optional parameters

Constants

LITLEN

The LITLEN (1024) limits the number of characters which can appear in a single attribute value literal

ATTSPLEN

The ATTSPLEN (2100) limits the sum of all lengths of all attribute value specifications which appear in a tag

TAGLEN

The TAGLEN (2100) limits the overall length of a tag

ATTS_TAG_LIMIT

ATTS_TAG_LIMIT is the length limit allowed for TAGLEN & ATTSPLEN DataURi

LIT_LIMIT

LIT_LIMIT is the length limit allowed for LITLEN DataURi

BASE_64

Base64 encode prefix

Methods

__construct(string $data, string $mimeType = null, array $parameters = array(), boolean $strict = false, int $lengthMode = self::TAGLEN)

A DataURI Object which by default has a 'text/plain' media type and a 'charset=US-ASCII' as optionnal parameter

string getData()

File Datas

string getMimeType()

Media type

string getParameters()

File parameters

boolean isBinaryData()

Data is binary data

Data setBinaryData(boolean $boolean)

Set if Data is binary data

File addParameters(string $paramName, string $paramValue)

Add a custom parameters to the DataURi

File write(string $pathfile, Boolean $override = false)

Write datas to the specified file

static Data buildFromFile(string $file, boolean $strict = false, int $lengthMode = Data::TAGLEN)

Get a new instance of DataUri\Data from a file

Details

at line 109
public __construct(string $data, string $mimeType = null, array $parameters = array(), boolean $strict = false, int $lengthMode = self::TAGLEN)

A DataURI Object which by default has a 'text/plain' media type and a 'charset=US-ASCII' as optionnal parameter

Parameters

string $data Data to include as "immediate" data
string $mimeType Mime type of media
array $parameters Array of optionnal parameters
boolean $strict Check length of datas
int $lengthMode Define Length of datas

at line 124
public string getData()

File Datas

Return Value

string

at line 133
public string getMimeType()

Media type

Return Value

string

at line 142
public string getParameters()

File parameters

Return Value

string

at line 151
public boolean isBinaryData()

Data is binary data

Return Value

boolean

at line 162
public Data setBinaryData(boolean $boolean)

Set if Data is binary data

Parameters

boolean $boolean

Return Value

Data

at line 175
public File addParameters(string $paramName, string $paramValue)

Add a custom parameters to the DataURi

Parameters

string $paramName
string $paramValue

Return Value

File

at line 192
public File write(string $pathfile, Boolean $override = false)

Write datas to the specified file

Parameters

string $pathfile File to be written
Boolean $override Override existing file

Return Value

File

Exceptions

FileNotFoundException

at line 211
static public Data buildFromFile(string $file, boolean $strict = false, int $lengthMode = Data::TAGLEN)

Get a new instance of DataUri\Data from a file

Parameters

string $file Path to the located file
boolean $strict Use strict mode
int $lengthMode The length mode

Return Value

Data