Class: Transformation

Transformation


new Transformation()

Represents a single transformation.

Example
t = new cloudinary.Transformation();
t.angle(20).crop("scale").width("auto");

// or

t = new cloudinary.Transformation( {angle: 20, crop: "scale", width: "auto"});

Methods


#chain()

Complete the current transformation and chain to a new one. In the URL, transformations are chained together by slashes.

Returns: Transformation

Returns this transformation for chaining

Type
Transformation
Example
var tr = cloudinary.Transformation.new();
tr.width(10).crop('fit').chain().angle(15).serialize()
// produces "c_fit,w_10/a_15"

#get(name)

Get the parameter object for the given parameter name

Parameters:
Name Type Description
name String

the name of the transformation parameter

Returns: Param

the param object for the given name, or undefined

Type
Param

#getParent()

Returns the parent of this object in the chain

Returns: Object

Returns the parent of this object if there is any

Type
Object

#getValue(name)

Use get.origValue for the value originally provided for the parameter

Parameters:
Name Type Description
name string

the name of the parameter

Returns: *

the processed value associated with the given name

Type
*

#listNames()

Provide a list of all the valid transformation option names

Returns: Array.<string>

a array of all the valid option names

Type
Array.<string>

#remove(name)

Remove a transformation option from the transformation.

Parameters:
Name Type Description
name string

the name of the option to remove

Returns: *

Returns the option that was removed or null if no option by that name was found. The type of the returned value depends on the value.

Type
*

#serialize()

Generate a string representation of the transformation.

Returns: string

Returns the transformation as a string

Type
string

#setParent(object)

Set a parent for this object for chaining purposes.

Parameters:
Name Type Description
object Object

the parent to be assigned to

Returns: Transformation

Returns this instance for chaining purposes.

Type
Transformation

#toHtml()

Delegate to the parent (up the call chain) to produce HTML

Returns: string

HTML representation of the parent if possible.

Type
string
Example
tag = cloudinary.ImageTag.new("sample", {cloud_name: "demo"})
// ImageTag {name: "img", publicId: "sample"}
tag.toHtml()
// <img src="http://res.cloudinary.com/demo/image/upload/sample">
tag.transformation().crop("fit").width(300).toHtml()
// <img src="http://res.cloudinary.com/demo/image/upload/c_fit,w_300/sample">

#toOptions()

Return an options object that can be used to create an identical Transformation

Returns: Object

Returns a plain object representing this transformation

Type
Object

#toPlainObject()

Returns a plain object representation of the transformation. Values are processed.

Returns: object

the transformation options as plain object

Type
object