Class: Cloudinary

Cloudinary


new Cloudinary(options)

Main Cloudinary class

Parameters:
Name Type Description
options object

options to configure Cloudinary

See:
  • Configuration for more details
Example
var cl = new cloudinary.Cloudinary( { cloud_name: "mycloud"});
var imgTag = cl.image("myPicID");

Members


<static, constant> DEFAULT_IMAGE_PARAMS :object

Defaults values for image parameters.

(Previously defined using option_consume() )

Type:
  • object

<static, constant> DEFAULT_VIDEO_PARAMS :object

Defaults values for video parameters.

Type:
  • object

Methods


.toHtmlAttributes()

Returns attributes for an HTML tag.

Returns:

PlainObject


#cloudinary_update(elements, options)

Update hidpi (dpr_auto) and responsive (w_auto) fields according to the current container size and the device pixel ratio. Only images marked with the cld-responsive class have w_auto updated.

Parameters:
Name Type Description
elements Array | string | NodeList

the elements to modify

options object
Properties
Name Type Argument Default Description
responsive_use_stoppoints boolean | string <optional>
'resize'
  • when true, always use stoppoints for width
  • when "resize" use exact width on first render and stoppoints on resize (default)
  • when false always use exact width
responsive boolean <optional>

if true, enable responsive on this element. Can be done by adding cld-responsive.

responsive_preserve_height boolean <optional>

if set to true, original css height is preserved. Should only be used if the transformation supports different aspect ratios.


#image(publicId, options)

Generate an image tag.

Parameters:
Name Type Argument Description
publicId string

the public ID of the image

options Object <optional>

options for the tag and transformations

Returns: HTMLImageElement

an image tag element

Type
HTMLImageElement

#imageTag(publicId, options)

Creates a new ImageTag instance, configured using this own's configuration.

Parameters:
Name Type Description
publicId string

the public ID of the resource

options object

additional options to pass to the new ImageTag instance

Returns: ImageTag

an instance of ImageTag

Type
ImageTag

#init()

Initialize configuration.

See:
Returns: Cloudinary

this for chaining

Type
Cloudinary

#processImageTags()

Finds all img tags under each node and sets it up to provide the image through Cloudinary


#transformation(options)

Provide a transformation object, initialized with own's options, for chaining purposes.

Parameters:
Name Type Description
options object
Returns: Transformation
Type
Transformation

#url(publicId, options)

Generate an resource URL.

Parameters:
Name Type Argument Description
publicId string

the public ID of the resource

options Object <optional>

options for the tag and transformations, possible values include all Transformation parameters and Configuration parameters

Properties
Name Type Argument Default Description
type string <optional>
'upload'

the classification of the resource

resource_type Object <optional>
'image'

the type of the resource

Returns: HTMLImageElement

an image tag element

Type
HTMLImageElement