new $k.Blob()
The value of a blob attribute.
Methods
base64String() : string
Returns the blob bytes as base 64 encoded string
Returns:
Type | Description |
---|---|
string |
charset() : string
Returns the charset of the blob
- Since:
- 5.1.0
Returns:
Type | Description |
---|---|
string |
convertImage(mediaType) : $k.NetEntity
Converts the image to another media type
Name | Type | Description |
---|---|---|
mediaType |
string |
The media type of the converted image |
Throws:
Type | Description |
---|---|
$k.exception.InvalidValue | If the image could not be converted |
Returns:
Type | Description |
---|---|
$k.NetEntity | The converted image |
createThumbnail(width, height, mediaType) : $k.NetEntity
Create a thumbnail with the specified maxium dimensions. The aspect ratio is preserved.
Width or height can be undefined, but not both.
The media type is optional and specifies the image type of the thumbnail.
If not defined, the thumbnail will have the same type as the original image.
Name | Type | Description |
---|---|---|
width |
number |
The maximum width of the thumbnail |
height |
number |
The maximum height of the thumbnail |
mediaType |
string |
optional
The media type of the converted image |
Throws:
Type | Description |
---|---|
$k.exception.InvalidValue | If the image could not be converted |
Returns:
Type | Description |
---|---|
$k.NetEntity | The converted image |
dataUrl() : string
Returns the blob bytes as a data URL
Returns:
Type | Description |
---|---|
string |
equals() : boolean
Returns true if the values are equal
Returns:
Type | Description |
---|---|
boolean |
fileExtension() : string
Returns the extension of the filename of the blob, without dot
Returns:
Type | Description |
---|---|
string |
filename() : string
Returns the filename of the blob
Returns:
Type | Description |
---|---|
string |
language() : string
Returns the language of the blob, or undefined if not translated
Returns:
Type | Description |
---|---|
string |
locator() : string
Returns a string that identifies the blob. Can be used to get the blob contents from the blob REST service.
Returns undefined if the blob is not stored as the value of an attribute yet.
Returns:
Type | Description |
---|---|
string |
mimeType() : string
Returns the mime type of the blob
Returns:
Type | Description |
---|---|
string |
setBase64String(string) : blob
Set the blob bytes from base 64 encoded string
Name | Type | Description |
---|---|---|
string |
string |
A base 64 encoded string |
- Since:
- 4.1.0
Returns:
Type | Description |
---|---|
blob |
setCharset(string) : blob
Set the charset of the blob
Name | Type | Description |
---|---|---|
string |
string |
- Since:
- 5.1.0
Returns:
Type | Description |
---|---|
blob |
setFilename(string) : blob
Set the filename of the blob
Name | Type | Description |
---|---|---|
string |
string |
- Since:
- 4.1.0
Returns:
Type | Description |
---|---|
blob |
setMimeType(string) : blob
Set the mime type of the blob
Name | Type | Description |
---|---|---|
string |
string |
- Since:
- 4.1.0
Returns:
Type | Description |
---|---|
blob |
size() : number
Returns the byte size of the blob
Returns:
Type | Description |
---|---|
number |
text(charset) : string
Returns the blob bytes as string
Name | Type | Description |
---|---|---|
charset |
string |
Charset of the characters. UTF-8 if undefined |
Returns:
Type | Description |
---|---|
string |
toNetEntity() : $k.NetEntity
Creates a NetEntity from this blob
Returns:
Type | Description |
---|---|
$k.NetEntity |