Members
(static) coverUrl
- Source:
A helper function to retrieve the main image for an event, group, realm or other content
Example
// returns 'https://api.fluro.io/get/event/5be504eabf33991239599d63?w=100&h=100'
fluro.asset.coverUrl('5be504eabf33991239599d63', 'event', {w:100, h:100})
Methods
(static) avatarUrl(personID, style, params) → {string}
- Source:
A helper function to generate a url for retrieving a user, persona or contact's avatar
Example
// returns 'https://api.fluro.io/get/avatar/contact/5be504eabf33991239599d63?w=100&h=100'
fluro.asset.avatarUrl('5be504eabf33991239599d63', 'contact', {w:100, h:100})
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
personID |
string | The id of the person you want to retrieve the avatar for | |||||||||
style |
string | Can be 'contact', 'persona' or 'user' | |||||||||
params |
object |
Properties
|
Returns:
A full URL that links to the image the user is requesting
- Type
- string
(static) downloadUrl(assetID, params) → {string}
- Source:
A helper function that returns a download url for a specific asset
Example
// returns 'https://api.fluro.io/download/5be504eabf33991239599d63'
fluro.asset.downloadUrl('5be504eabf33991239599d63')
// returns 'https://api.fluro.io/download/5be504eabf33991239599d63/file/MyFile.docx'
fluro.asset.downloadUrl('5be504eabf33991239599d63', {filename:'MyFile.docx'})
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
assetID |
string | The id of the asset, or the asset object you want to download | |||||||||
params |
object |
Properties
|
Returns:
A full URL that will download the file
- Type
- string
(static) filesize(bytes) → {String}
- Source:
Helper function to translate bytes into a human readable format
Example
// returns '1mb'
fluro.asset.filesize(1000000)
Parameters:
Name | Type | Description |
---|---|---|
bytes |
Integer | The number of bytes |
Returns:
The human readable filesize
- Type
- String
(static) getUrl(assetID, params) → {string}
- Source:
This function generates a url for the binary data of an
asset, image, audio, or video file that has been uploaded to Fluro
Example
// returns 'https://api.fluro.io/get/5be504eabf33991239599d63'
fluro.asset.getUrl('5be504eabf33991239599d63')
// returns 'https://api.fluro.io/get/5be504eabf33991239599d63/file/MyFile.pdf'
fluro.asset.getUrl('5be504eabf33991239599d63', {filename:'MyFile.pdf'})
Parameters:
Name | Type | Description |
---|---|---|
assetID |
string | The _id of the item you want to retrieve |
params |
object |
Returns:
A valid Fluro URL
- Type
- string
(static) imageUrl(imageID, width, height, params) → {string}
- Source:
A helper function that creates a url image for a specified image
Example
// returns 'https://api.fluro.io/get/5be504eabf33991239599d63?w=800'
fluro.asset.imageUrl('5be504eabf33991239599d63', 800)
// returns 'https://api.fluro.io/get/5be504eabf33991239599d63/file/image.jpg?w=800'
fluro.asset.imageUrl('5be504eabf33991239599d63', 800, null, {filename:'MyFile.pdf'})
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
imageID |
string | The id of the image or an object representing the image that has an _id property | ||||||||||||
width |
Integer | The width of the image to retrieve from Fluro. If none is specified then will default to a size based on the requesting user's screen dimensions. | ||||||||||||
height |
Integer | The height of the image to retrieve from Fluro. If none is specified then will default to a size based on the requesting user's screen dimensions. | ||||||||||||
params |
object |
Properties
|
Returns:
A full URL of the image
- Type
- string
(static) playerUrl(videoID, params) → {string}
- Source:
This function generates a player url for a video file that has been uploaded to Fluro
This is useful to force browsers to renderer a html5 video player instead of downloading the video file on desktop
Example
// returns 'https://api.fluro.io/get/player?url=https://api.fluro.io/get/5be504eabf33991239599d63'
fluro.asset.playerUrl('5be504eabf33991239599d63')
Parameters:
Name | Type | Description |
---|---|---|
videoID |
string | The _id of the video you want to play |
params |
object |
Returns:
A valid Fluro URL
- Type
- string
(static) posterUrl(videoID, width, height, params) → {string}
- Source:
A helper function that returns a poster image for a specified video
Example
// returns 'https://api.fluro.io/get/poster/5be504eabf33991239599d63?w=1920&h=1080'
fluro.asset.posterUrl('5be504eabf33991239599d63', 1920, 1080)
// returns 'https://api.fluro.io/get/poster/5be504eabf33991239599d63/file/file.jpg?w=1920&h=1080'
fluro.asset.posterUrl('5be504eabf33991239599d63', 1920, 1080, {extension:'jpg'})
//Not providing a height property will default to 16:9 ratio inferred from the width
//returns 'https://api.fluro.io/get/poster/5be504eabf33991239599d63/file/MyPoster.jpg?w=1920&h=1080'
fluro.asset.posterUrl('5be504eabf33991239599d63', 1920, null, {filename:'MyPoster.jpg'})
Parameters:
Name | Type | Description |
---|---|---|
videoID |
string | The id of the video, or a video object that has an _id property |
width |
number | The width of the poster image. If none specified will default to 16:9 based on the requesting user's screen size |
height |
number | The height of the poster image. If none specified will default to 16:9 based on the requesting user's screen size |
params |
object |
Returns:
A full URL of the poster image
- Type
- string
(static) typeFromMime(mimetype) → {string}
- Source:
A helper function that returns what type of content Fluro will attribute a specified mimetype to
Example
// returns 'audio'
fluro.asset.typeFromMime('audio/aac')
// returns 'video'
fluro.asset.typeFromMime('video/ogg')
// returns 'asset'
fluro.asset.typeFromMime('application/pdf')
Parameters:
Name | Type | Description |
---|---|---|
mimetype |
string | The mimetype of a file |
Returns:
Whether this mimetype is an 'asset', 'video', 'image', or 'audio' file
- Type
- string