Class: Caman.IO

Defined in: src/core/io.coffee

Overview

Various I/O based operations

Class Method Summary

Class Method Details

+ (Boolean) isRemote(img)

Is the given URL remote? If a cross-origin setting is set, we assume you have CORS properly configured.

Parameters:

  • img (DOMObject) The image to check.

Returns:

  • Boolean

+ (Boolean) corsEnabled(img)

Given an image, we check to see if a CORS policy has been defined.

Parameters:

  • img (DOMObject) The image to check.

Returns:

  • Boolean

+ (Boolean) isURLRemote(url)

Does the given URL exist on a different domain than the current one? This is done by comparing the URL to document.domain.

Parameters:

  • url (String) The URL to check.

Returns:

  • Boolean

+ (String) remoteCheck(src)

Checks to see if the URL is remote, and if there is a proxy defined, it

Parameters:

  • src (String) The URL to check.

Returns:

  • (String) — The proxy URL if the image is remote. Nothing otherwise.

+ (String) proxyUrl(src)

Given a URL, get the proxy URL for it.

Parameters:

  • src (String) The URL to proxy.

Returns:

  • (String) — The proxy URL.

+ (String) useProxy(lang)

Shortcut for using one of the bundled proxies.

Parameters:

  • lang (String) String identifier for the proxy script language.

Returns:

  • (String) — A proxy URL.