Git Product home page Git Product logo

cloudinary_scala's Introduction

Build Status

The Scala SDK is deprecated and is no longer maintained, with the exception of any high-priority regression bugs that may arise.

We recommend that you use one of Cloudinary's many active and fully supported SDKs. For details and complete documentation on all available GitHub, see our Cloudinary SDK Guides.

Cloudinary

Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.

Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. Images are seamlessly delivered through a fast CDN, and much much more.

Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new.

Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.

For Scala, Cloudinary provides a library for simplifying the integration even further. A Scala Play plugin is provided as well.

Setup

The Play 2.4 branch is not currently published to a Maven repository. To use it in your project you can run sbt publishLocal.

To use it, add the following dependency to your build.sbt:

resolvers += Resolver.file("Local Ivy", file(Path.userHome + "/.ivy2/local"))(Resolver.ivyStylePatterns)

libraryDependencies += "com.cloudinary" %% "cloudinary-core-scala" % "2.0.0"

If using the Play 2.4 you can add:

"com.cloudinary" %% "cloudinary-scala-play" % "1.2.1"

In your controller inject an instance of CloudinaryResourceBuilder and make sure to declare an implicit reference to the enclosed Cloudinary instance and import preloadedFormatter. For example:

class PhotosController @Inject() (cloudinaryResourceBuilder: CloudinaryResourceBuilder) extends Controller {
  
  implicit val cld:com.cloudinary.Cloudinary = cloudinaryResourceBuilder.cld
  import cloudinaryResourceBuilder.preloadedFormatter
  ..
}

To use it in a view or to use one of the included view helpers have your Twirl view accept an implicit Cloudinary instance. For example:

@(implicit cld:com.cloudinary.Cloudinary)
...
<img src="@url("officialchucknorrispage", Set('format -> "png", 'type -> "facebook", 
    'transformation -> Transformation().h_(95).w_(95).c_("thumb").g_("face").e_("sepia").r_(20)./.a_(10)))">

Try it right away

Sign up for a free account so you can try out image transformations and seamless image delivery through CDN.

Note: Replace demo in all the following examples with your Cloudinary's cloud name.

Accessing an uploaded image with the sample public ID through a CDN:

http://res.cloudinary.com/demo/image/upload/sample.jpg

Sample

Generating a 150x100 version of the sample image and downloading it through a CDN:

http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill/sample.jpg

Sample 150x100

Converting to a 150x100 PNG with rounded corners of 20 pixels:

http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill,r_20/sample.png

Sample 150x150 Rounded PNG

For plenty more transformation options, see our image transformations documentation.

Generating a 120x90 thumbnail based on automatic face detection of the Facebook profile picture of Bill Clinton:

http://res.cloudinary.com/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg

Facebook 90x120

For more details, see our documentation for embedding Facebook and Twitter profile pictures.

Usage

Configuration

When using the client library directly

Each request for building a URL of a remote cloud resource must have the cloud_name parameter set. Each request to our secure APIs (e.g., image uploads, eager sprite generation) must have the api_key and api_secret parameters set. See API, URLs and access identifiers for more details.

Setting the cloud_name, api_key and api_secret parameters can be done either directly in each call to a Cloudinary method, by initializing the Cloudinary object, or by using the CLOUDINARY_URL environment variable / system property.

The entry point of the library is the Cloudinary object.

val cloudinary = new Cloudinary()

Here's an example of setting the configuration parameters programatically:

val cloudinary = new Cloudinary(Map(
  "cloud_name" -> "n07t21i7",
  "api_key" -> "123456789012345",
  "api_secret" -> "abcdeghijklmnopqrstuvwxyz12"
))

Another example of setting the configuration parameters by providing the CLOUDINARY_URL value to the constructor:

val cloudinary = new Cloudinary("cloudinary://123456789012345:abcdeghijklmnopqrstuvwxyz12@n07t21i7")

When using the Play plugin

Add cloudinary block in your application.conf:

cloudinary = {
  cloud_name = n07t21i7
  api_key = 123456789012345
  api_secret = abcdeghijklmnopqrstuvwxyz12
}

Embedding and transforming images

Any image uploaded to Cloudinary can be transformed and embedded using powerful view helper methods:

The following example generates the url for accessing an uploaded sample image while transforming it to fill a 100x150 rectangle:

cloudinary.url().transformation(Transformation().width(100).height(150).
                                crop("fill")).
                 generate("sample.jpg")

Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail (note the shorter syntax):

cloudinary.url().transformation(Transformation().w_(90).h_(90).
                                c_("thumb").g_("face")).
                 generate("woman.jpg")

You can provide either a Facebook name or a numeric ID of a Facebook profile or a fan page.

Embedding a Facebook profile to match your graphic design is very simple:

cloudinary.url().type("facebook").
                 transformation(Transformation().width(130).height(130).
                                crop("fill").gravity("north_west")).
                 generate("billclinton.jpg")

Same goes for Twitter:

cloudinary.url().type("twitter_name").generate("billclinton.jpg")

Upload

Assuming you have your Cloudinary configuration parameters defined (cloud_name, api_key, api_secret), uploading to Cloudinary is very simple.

The following example uploads a local JPG to the cloud:

cloudinary.uploader().upload("my_picture.jpg")

The uploaded image is assigned a randomly generated public ID. The image is immediately available for download through a CDN:

cloudinary.url().generate("abcfrmo8zul1mafopawefg.jpg")
http://res.cloudinary.com/demo/image/upload/abcfrmo8zul1mafopawefg.jpg

You can also specify your own public ID:

import com.cloudinary.parameters.UploadParameters
import com.cloudinary.Implicits._

cloudinary.uploader().upload("http://www.example.com/image.jpg", 
                             UploadParameters(publicId = "sample_remote"))

cloudinary.url().generate("sample_remote.jpg")
http://res.cloudinary.com/demo/image/upload/sample_remote.jpg

Play Helpers

Import using:

@import cloudinary.views.html.helper._

url

Returns the URL to Cloudinary encoding transformation and URL options:

Usage:

@url("sample", Set('transformation -> Transformation().width(100).height(100).crop("fill"), 'format -> "png"))

# http://res.cloudinary.com/cloud_name/image/upload/c_fill,h_100,w_100/sample.png

Additional resources

Additional resources are available at:

Support

You can open an issue through GitHub.

Contact us http://cloudinary.com/contact

Stay tuned for updates, tips and tutorials: Blog, Twitter, Facebook.

License

Released under the MIT license.

cloudinary_scala's People

Contributors

asisayag2 avatar avgp avatar blast-hardcheese avatar itaibenari avatar janghwan avatar jgrape avatar nitzanj avatar patrick-tolosa avatar tallevami avatar tocker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudinary_scala's Issues

UNRESOLVED DEPENDENCY

Hi,

I tried to include this lib on my project but I got UNRESOLVED DEPENDENCY :(

[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com/cloudinary/cloudinary-core-scala_2.10/0.9.7-SNAPSHOT/cloudinary-core-scala_2.10-0.9.7-SNAPSHOT.pom
[warn] ==== Typesafe Releases Repository: tried
[warn]   http://repo.typesafe.com/typesafe/releases/com/cloudinary/cloudinary-core-scala_2.10/0.9.7-SNAPSHOT/cloudinary-core-scala_2.10-0.9.7-SNAPSHOT.pom
[warn] ==== Sonatype snapshots: tried
[warn]   http://oss.sonatype.org/content/repositories/snapshots/com/cloudinary/cloudinary-core-scala_2.10/0.9.7-SNAPSHOT/cloudinary-core-scala_2.10-0.9.7-SNAPSHOT.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.cloudinary#cloudinary-core-scala_2.10;0.9.7-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

For info, I added "com.cloudinary" %% "cloudinary-core-scala" % "0.9.7-SNAPSHOT" as dependency and "Sonatype snapshots" at "http://oss.sonatype.org/content/repositories/snapshots/" as resolver.
I use Play 2.2.3 with scala 2.10.3

Thanks for help :)

Play plugin dependency failing

Getting error when trying to use play plugin
"com.cloudinary" %% "cloudinary-scala-play" % "0.9.2-SNAPSHOT"

sbt.ResolveException: download failed: com.typesafe.sbt#sbt-pgp;0.8.1!sbt-pgp.jar(src)

Play 2.2.2
Scala 2.10
SBT 0.13.0

jshint error

There are issues with the jquery.cloudinary.js file. The javascript works fine, but jshint does not like the way this file is written. For example in line 152, I get the error 'i' is already defined because variable i has been defined in the previous for loop. To see this issue, please enable the jshint plugin included with play by adding to plugins.sbt this line addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1").

Can't resolve dependency from maven on sonatype

I'm trying to resolve core scala version of lib from https://oss.sonatype.org/content/repositories/snapshots/com/cloudinary/cloudinary-core-scala_2.11/ and got error

from build.sbt:

resolvers += "sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

libraryDependencies += "com.cloudinary" %% "cloudinary-core-scala" % "0.9.8-SNAPSHOT"
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
[info] Loading project definition from /Users/soi/IdeaProjects/so_scala_commons/so_backend_images/project
[info] Set current project to so_backend_images (in build file:/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/)
> [info] Defining *:shellPrompt
[info] The new value will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to so_backend_images (in build file:/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/)
[info] Defining */*:sbtStructureOutputFile
[info] The new value will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to so_backend_images (in build file:/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/)
[info] Defining */*:sbtStructureOptions
[info] The new value will be used by no settings or tasks.
[info] Reapplying settings...
[info] Set current project to so_backend_images (in build file:/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/)
[info] Applying State transformations org.jetbrains.sbt.CreateTasks from /Users/soi/Library/Application Support/IntelliJIdea2016.2/Scala/launcher/sbt-structure-0.13.jar
[info] Set current project to so_backend_images (in build file:/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/)
[info] Updating {file:/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/}so_backend_images...
[info] Resolving org.scala-lang#scala-library;2.11.8 ...
[info] Resolving com.cloudinary#cloudinary-core-scala_2.11;0.9.8-SNAPSHOT ...
[info] Resolving com.cloudinary#cloudinary-core-scala_2.11;0.9.8-SNAPSHOT ...
[info] Resolving com.ning#async-http-client;1.9.30 ...
[info] Resolving com.ning#async-http-client;1.9.30 ...
[warn]  module not found: com.ning#async-http-client;1.9.30
[warn] ==== local: tried
[warn]   /Users/soi/.ivy2/local/com.ning/async-http-client/1.9.30/ivys/ivy.xml
[warn] ==== my-ivy-proxy-releases: tried
[warn]   http://red-services.isaacloud.com/artifactory/smo-commons/com.ning/async-http-client/1.9.30/ivys/ivy.xml
[warn] ==== my-maven-proxy-releases: tried
[warn]   http://red-services.isaacloud.com/artifactory/smo-commons/com/ning/async-http-client/1.9.30/async-http-client-1.9.30.pom
[warn] ==== sonatype snapshots: tried
[warn]   https://oss.sonatype.org/content/repositories/snapshots/com/ning/async-http-client/1.9.30/async-http-client-1.9.30.pom
[info] Resolving org.json4s#json4s-native_2.11;3.2.10 ...
[info] Resolving org.json4s#json4s-native_2.11;3.2.10 ...
[warn]  module not found: org.json4s#json4s-native_2.11;3.2.10
[warn] ==== local: tried
[warn]   /Users/soi/.ivy2/local/org.json4s/json4s-native_2.11/3.2.10/ivys/ivy.xml
[warn] ==== my-ivy-proxy-releases: tried
[warn]   http://red-services.isaacloud.com/artifactory/smo-commons/org.json4s/json4s-native_2.11/3.2.10/ivys/ivy.xml
[warn] ==== my-maven-proxy-releases: tried
[warn]   http://red-services.isaacloud.com/artifactory/smo-commons/org/json4s/json4s-native_2.11/3.2.10/json4s-native_2.11-3.2.10.pom
[warn] ==== sonatype snapshots: tried
[warn]   https://oss.sonatype.org/content/repositories/snapshots/org/json4s/json4s-native_2.11/3.2.10/json4s-native_2.11-3.2.10.pom
[info] Resolving org.json4s#json4s-ext_2.11;3.2.10 ...
[info] Resolving org.json4s#json4s-ext_2.11;3.2.10 ...
[warn]  module not found: org.json4s#json4s-ext_2.11;3.2.10
[warn] ==== local: tried
[warn]   /Users/soi/.ivy2/local/org.json4s/json4s-ext_2.11/3.2.10/ivys/ivy.xml
[warn] ==== my-ivy-proxy-releases: tried
[warn]   http://red-services.isaacloud.com/artifactory/smo-commons/org.json4s/json4s-ext_2.11/3.2.10/ivys/ivy.xml
[warn] ==== my-maven-proxy-releases: tried
[warn]   http://red-services.isaacloud.com/artifactory/smo-commons/org/json4s/json4s-ext_2.11/3.2.10/json4s-ext_2.11-3.2.10.pom
[warn] ==== sonatype snapshots: tried
[warn]   https://oss.sonatype.org/content/repositories/snapshots/org/json4s/json4s-ext_2.11/3.2.10/json4s-ext_2.11-3.2.10.pom
[info] Resolving org.scala-lang#scala-compiler;2.11.8 ...
[info] Resolving org.scala-lang#scala-reflect;2.11.8 ...
[info] Resolving org.scala-lang.modules#scala-xml_2.11;1.0.4 ...
[info] Resolving org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4 ...
[info] Resolving jline#jline;2.12.1 ...
[info] downloading https://oss.sonatype.org/content/repositories/snapshots/com/cloudinary/cloudinary-core-scala_2.11/0.9.8-SNAPSHOT/cloudinary-core-scala_2.11-0.9.8-SNAPSHOT.jar ...
[info]  [SUCCESSFUL ] com.cloudinary#cloudinary-core-scala_2.11;0.9.8-SNAPSHOT!cloudinary-core-scala_2.11.jar (1537ms)
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.ning#async-http-client;1.9.30: not found
[warn]  :: org.json4s#json4s-native_2.11;3.2.10: not found
[warn]  :: org.json4s#json4s-ext_2.11;3.2.10: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Unresolved dependencies path:
[warn]      com.ning:async-http-client:1.9.30
[warn]        +- com.cloudinary:cloudinary-core-scala_2.11:0.9.8-SNAPSHOT (/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/build.sbt#L9-10)
[warn]        +- default:so_backend_images_2.11:1.0
[warn]      org.json4s:json4s-native_2.11:3.2.10
[warn]        +- com.cloudinary:cloudinary-core-scala_2.11:0.9.8-SNAPSHOT (/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/build.sbt#L9-10)
[warn]        +- default:so_backend_images_2.11:1.0
[warn]      org.json4s:json4s-ext_2.11:3.2.10
[warn]        +- com.cloudinary:cloudinary-core-scala_2.11:0.9.8-SNAPSHOT (/Users/soi/IdeaProjects/so_scala_commons/so_backend_images/build.sbt#L9-10)
[warn]        +- default:so_backend_images_2.11:1.0
[info] Resolving org.scala-sbt#sbt;0.13.8 ...
[info] Resolving org.scala-lang#scala-library;2.10.4 ...
[info] Resolving org.scala-sbt#main;0.13.8 ...
[info] Resolving org.scala-sbt#actions;0.13.8 ...
[info] Resolving org.scala-sbt#classpath;0.13.8 ...
[info] Resolving org.scala-lang#scala-compiler;2.10.4 ...
[info] Resolving org.scala-lang#scala-reflect;2.10.4 ...
[info] Resolving org.scala-sbt#launcher-interface;0.13.8 ...
[info] Resolving org.scala-sbt#interface;0.13.8 ...
[info] Resolving org.scala-sbt#io;0.13.8 ...
[info] Resolving org.scala-sbt#control;0.13.8 ...
[info] Resolving org.scala-sbt#completion;0.13.8 ...
[info] Resolving org.scala-sbt#collections;0.13.8 ...
[info] Resolving jline#jline;2.11 ...
[info] Resolving org.scala-sbt#api;0.13.8 ...
[info] Resolving org.scala-sbt#compiler-integration;0.13.8 ...
[info] Resolving org.scala-sbt#incremental-compiler;0.13.8 ...
[info] Resolving org.scala-sbt#logging;0.13.8 ...
[info] Resolving org.scala-sbt#process;0.13.8 ...
[info] Resolving org.scala-sbt#relation;0.13.8 ...
[info] Resolving org.scala-sbt#compile;0.13.8 ...
[info] Resolving org.scala-sbt#classfile;0.13.8 ...
[info] Resolving org.scala-sbt#persist;0.13.8 ...
[info] Resolving org.scala-tools.sbinary#sbinary_2.10;0.4.2 ...
[info] Resolving org.scala-sbt#compiler-ivy-integration;0.13.8 ...
[info] Resolving org.scala-sbt#ivy;0.13.8 ...
[info] Resolving org.scala-sbt#cross;0.13.8 ...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f ...
[info] Resolving com.jcraft#jsch;0.1.46 ...
[info] Resolving org.scala-sbt#serialization_2.10;0.1.1 ...
[info] Resolving org.scala-lang.modules#scala-pickling_2.10;0.10.0 ...
[info] Resolving org.scalamacros#quasiquotes_2.10;2.0.1 ...
[info] Resolving org.json4s#json4s-core_2.10;3.2.10 ...
[info] Resolving org.json4s#json4s-ast_2.10;3.2.10 ...
[info] Resolving com.thoughtworks.paranamer#paranamer;2.6 ...
[info] Resolving org.spire-math#jawn-parser_2.10;0.6.0 ...
[info] Resolving org.spire-math#json4s-support_2.10;0.6.0 ...
[info] Resolving org.scala-sbt#run;0.13.8 ...
[info] Resolving org.scala-sbt#task-system;0.13.8 ...
[info] Resolving org.scala-sbt#tasks;0.13.8 ...
[info] Resolving org.scala-sbt#tracking;0.13.8 ...
[info] Resolving org.scala-sbt#cache;0.13.8 ...
[info] Resolving org.scala-sbt#testing;0.13.8 ...
[info] Resolving org.scala-sbt#test-agent;0.13.8 ...
[info] Resolving org.scala-sbt#test-interface;1.0 ...
[info] Resolving org.scala-sbt#main-settings;0.13.8 ...
[info] Resolving org.scala-sbt#apply-macro;0.13.8 ...
[info] Resolving org.scala-sbt#command;0.13.8 ...
[info] Resolving org.scala-sbt#logic;0.13.8 ...
[info] Resolving org.scala-sbt#compiler-interface;0.13.8 ...
[info] Resolving org.scala-sbt#precompiled-2_8_2;0.13.8 ...
[info] Resolving org.scala-sbt#precompiled-2_9_2;0.13.8 ...
[info] Resolving org.scala-sbt#precompiled-2_9_3;0.13.8 ...
[info] Resolving org.scala-sbt#sbt;0.13.8 ...
[info] Resolving org.scala-lang#scala-library;2.10.4 ...
[info] Resolving org.scala-sbt#main;0.13.8 ...
[info] Resolving org.scala-sbt#actions;0.13.8 ...
[info] Resolving org.scala-sbt#classpath;0.13.8 ...
[info] Resolving org.scala-lang#scala-compiler;2.10.4 ...
[info] Resolving org.scala-lang#scala-reflect;2.10.4 ...
[info] Resolving org.scala-sbt#launcher-interface;0.13.8 ...
[info] Resolving org.scala-sbt#interface;0.13.8 ...
[info] Resolving org.scala-sbt#io;0.13.8 ...
[info] Resolving org.scala-sbt#control;0.13.8 ...
[info] Resolving org.scala-sbt#completion;0.13.8 ...
[info] Resolving org.scala-sbt#collections;0.13.8 ...
[info] Resolving jline#jline;2.11 ...
[info] Resolving org.scala-sbt#api;0.13.8 ...
[info] Resolving org.scala-sbt#compiler-integration;0.13.8 ...
[info] Resolving org.scala-sbt#incremental-compiler;0.13.8 ...
[info] Resolving org.scala-sbt#logging;0.13.8 ...
[info] Resolving org.scala-sbt#process;0.13.8 ...
[info] Resolving org.scala-sbt#relation;0.13.8 ...
[info] Resolving org.scala-sbt#compile;0.13.8 ...
[info] Resolving org.scala-sbt#classfile;0.13.8 ...
[info] Resolving org.scala-sbt#persist;0.13.8 ...
[info] Resolving org.scala-tools.sbinary#sbinary_2.10;0.4.2 ...
[info] Resolving org.scala-sbt#compiler-ivy-integration;0.13.8 ...
[info] Resolving org.scala-sbt#ivy;0.13.8 ...
[info] Resolving org.scala-sbt#cross;0.13.8 ...
[info] Resolving org.scala-sbt.ivy#ivy;2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f ...
[info] Resolving com.jcraft#jsch;0.1.46 ...
[info] Resolving org.scala-sbt#serialization_2.10;0.1.1 ...
[info] Resolving org.scala-lang.modules#scala-pickling_2.10;0.10.0 ...
[info] Resolving org.scalamacros#quasiquotes_2.10;2.0.1 ...
[info] Resolving org.json4s#json4s-core_2.10;3.2.10 ...
[info] Resolving org.json4s#json4s-ast_2.10;3.2.10 ...
[info] Resolving com.thoughtworks.paranamer#paranamer;2.6 ...
[info] Resolving org.spire-math#jawn-parser_2.10;0.6.0 ...
[info] Resolving org.spire-math#json4s-support_2.10;0.6.0 ...
[info] Resolving org.scala-sbt#run;0.13.8 ...
[info] Resolving org.scala-sbt#task-system;0.13.8 ...
[info] Resolving org.scala-sbt#tasks;0.13.8 ...
[info] Resolving org.scala-sbt#tracking;0.13.8 ...
[info] Resolving org.scala-sbt#cache;0.13.8 ...
[info] Resolving org.scala-sbt#testing;0.13.8 ...
[info] Resolving org.scala-sbt#test-agent;0.13.8 ...
[info] Resolving org.scala-sbt#test-interface;1.0 ...
[info] Resolving org.scala-sbt#main-settings;0.13.8 ...
[info] Resolving org.scala-sbt#apply-macro;0.13.8 ...
[info] Resolving org.scala-sbt#command;0.13.8 ...
[info] Resolving org.scala-sbt#logic;0.13.8 ...
[info] Resolving org.scala-sbt#precompiled-2_8_2;0.13.8 ...
[info] Resolving org.scala-sbt#precompiled-2_9_2;0.13.8 ...
[info] Resolving org.scala-sbt#precompiled-2_9_3;0.13.8 ...
[trace] Stack trace suppressed: run 'last *:update' for the full output.
[trace] Stack trace suppressed: run 'last *:ssExtractDependencies' for the full output.
[error] (*:update) sbt.ResolveException: unresolved dependency: com.ning#async-http-client;1.9.30: not found
[error] unresolved dependency: org.json4s#json4s-native_2.11;3.2.10: not found
[error] unresolved dependency: org.json4s#json4s-ext_2.11;3.2.10: not found
[error] (*:ssExtractDependencies) sbt.ResolveException: unresolved dependency: com.ning#async-http-client;1.9.30: not found
[error] unresolved dependency: org.json4s#json4s-native_2.11;3.2.10: not found
[error] unresolved dependency: org.json4s#json4s-ext_2.11;3.2.10: not found
[error] Total time: 15 s, completed Aug 8, 2016 2:06:48 PM

Upload large video

Hi,
to upload large videos I guess uploadLargeRaw function should be used.
However, it uploads the file as a file, not the video. How can I specify a folder name and filename for such uploads? I don't see them in LargeUploadParameters.
As I can see, I cannot do transformations either, right?

Thank you.

Support playframework 2.8

The release 2.0 is linked with playframework 2.6.6, but uses API which are deprecated in 2.6.

Please update your code base to align with playframework 2.6 or create a version which only supports playframework 2.8+

Currently, this plugin is not usable with playframework 2.8.

CloudinaryPlugin should support CLOUDINARY_URL

Today the CloudinaryPlugin is configured by a number of properties set in the application.conf. Yet, outside Play (in cloudinary-core-scala) a Cloudinary instance can be created from only one variable - the CLOUDINARY_URL.

It would be great in the Play plugin could be configured using the CLOUDINARY_URL.

One way of achieving this would be to allow the plugin to be initiated using a single property cloudinary.url in application.conf.

In application.conf, the environment variable CLOUDINARY_URL can be picked up using:

cloudinary.url = ${?CLOUDINARY_URL}

This would work perfectly with the Cloudinary Heroku addon, since it automatically sets this environment variable.

Play compilation error caused by trailing comma in jquery.cloudinary.js

It looks like there is a redundant trailing comma in JS array in app/assets/javascripts/cloudinary/jquery.cloudinary.js which is causing compilation error in Play 2.2.2

play.PlayExceptions$AssetCompilationException: Compilation error[Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer versions of JS, set the appropriate language_in option.]

CloudinaryPlugin Constructor Issue

Using play framework 2.4 this is the exception I get when I try to do something like

@url("sample", Set('transformation -> Transformation().width(100).height(100).crop("fill"), 'format -> "png"))

ConfigurationException: Guice configuration errors:

  1. Could not find a suitable constructor in cloudinary.plugin.CloudinaryPlugin. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.
    at cloudinary.plugin.CloudinaryPlugin.class(CloudinaryPlugin.scala:13)
    while locating cloudinary.plugin.CloudinaryPlugin

Do not use snapshot version to publish lib

It is a very bad practive to use snapshot version to maven/sbt publish artifact because you can change lib without updating version and perform bugs in production app user of the artifact.

Exception thrown during upload.

We were attempting to upgrade our version of the library to the latest and we began encountering this error during image upload

org.json4s.package$MappingException: unknown error
In:
JObject(List((public_id,JString(ise26l8mxqm5adgerxpf)), (version,JInt(1432652459)), (signature,JString(b84a3167bb4032068f4677b8f862898c79831f20)), (width,JInt(636)), (height,JInt(457)), (format,JString(jpg)), (resource_type,JString(image)), (created_at,JString(2015-05-26T15:00:59Z)), (tags,JArray(List())), (bytes,JInt(201588)), (type,JString(upload)), (etag,JString(88aa9ceb7337c44a52a70419779d8dde)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (eager,JArray(List(JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fit,fl_progressive,q_80,w_636/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fit,fl_progressive,q_80,w_636/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_north,h_358,q_80,w_636/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_north,h_358,q_80,w_636/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_center,h_358,q_80,w_636/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_center,h_358,q_80,w_636/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fit,fl_progressive,q_80,w_470/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fit,fl_progressive,q_80,w_470/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_north,h_264,q_80,w_470/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_north,h_264,q_80,w_470/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fit,fl_progressive,q_80,w_320/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fit,fl_progressive,q_80,w_320/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_north,h_180,q_80,w_320/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_north,h_180,q_80,w_320/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_center,h_180,q_80,w_320/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_center,h_180,q_80,w_320/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_north,h_77,q_80,w_137/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_north,h_77,q_80,w_137/v1432652459/ise26l8mxqm5adgerxpf.jpg)))), JObject(List((status,JString(processing)), (batch_id,JString(4f1d457168618571ec18124e2bb1669cba4fed0ffa538d62bd8bdcf7c9e2f1315b62b16020207338b0445882f5c7743a)), (url,JString(http://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_center,h_77,q_80,w_137/v1432652459/ise26l8mxqm5adgerxpf.jpg)), (secure_url,JString(https://res.cloudinary.com/gawker-media/image/upload/c_fill,fl_progressive,g_center,h_77,q_80,w_137/v1432652459/ise26l8mxqm5adgerxpf.jpg)))))))))
    at com.cloudinary.HttpClient$$anonfun$executeAndExtractResponse$1.apply(HttpClient.scala:61) ~[cloudinary-core-scala_2.10-0.9.7.1.jar:0.9.7.1]
    at com.cloudinary.HttpClient$$anonfun$executeAndExtractResponse$1.apply(HttpClient.scala:54) ~[cloudinary-core-scala_2.10-0.9.7.1.jar:0.9.7.1]
    at scala.util.Success$$anonfun$map$1.apply(Try.scala:206) ~[scala-library.jar:na]
    at scala.util.Try$.apply(Try.scala:161) ~[scala-library.jar:na]
    at scala.util.Success.map(Try.scala:206) ~[scala-library.jar:na]
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) ~[scala-library.jar:na]
    at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235) ~[scala-library.jar:na]
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) ~[scala-library.jar:na]
    at scala.concurrent.impl.ExecutionContextImpl$$anon$3.exec(ExecutionContextImpl.scala:107) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) ~[scala-library.jar:na]
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) ~[scala-library.jar:na]

This is how we use the library:

// url : String, eager : List[Size], pId : Option[String], async : Boolean, moderated : Boolean
try {
    val eagerTransforms = eager.map(sizeToTransformation)
    val up = pId.map(UploadParameters()
        .publicId(_)).getOrElse(UploadParameters())
        .eager(eagerTransforms)
        .eagerAsync(async)
        .tags(if (url.takeWhile(_ != '?').endsWith(".gif")) Set("gif") else Set())
    val params =
        if (moderated)
            up.moderation("webpurify")
        else
            up
    cloud.uploader().upload(url, params).map {
        response => ImageResponse(response.raw)
    } recoverWith (handleUploadErrors andThen Future.failed)
} catch (handleUploadErrors andThen Future.failed))

Missing support for Play 2.3

I'm upgrading from Play 2.2.2 to Play 2.3.7 and I get stuck on a missing dependency:

[error] (*:update) sbt.ResolveException: unresolved dependency: com.cloudinary#cloudinary-scala-play_2.11;0.9.3-SNAPSHOT: not found

Looking in the Sonatype snapshots repo I can see that the core bits are compiled for both Scala 2.10 and 2.11, but the Play plugin is only compiled for Scala 2.10 (which is used in Play 2.2.2) and not for Scala 2.11 (which is used in Play 2.3.7)

Update to support Scala 2.13

Currently, the library is not cross-built with scala 2.13

Scala 2.13 has been released 2019. Two years later, there is no build for scala 2.13.

Unresloved dependencies: Can't build with Play framework

When I try to build I get:

[warn]  ::::::::::::::::::::::::::::::::::::::::::::::                
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.cloudinary#cloudinary-core-scala_2.10;0.9.2-SNAPSHOT: not found
[warn]  :: com.cloudinary#cloudinary-scala-play_2.10;0.9.2-SNAPSHOT: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::

The docs says the plugin should be at Maven Central, but http://search.maven.org/ doesn't give any hit on either of the two dependencies.

Can't upload message

I tried uploading image using "com.cloudinary" %% "cloudinary-core-scala" % "0.9.8-SNAPSHOT" and app crashed with stacktrace:


java.lang.NoClassDefFoundError: Could not initialize class com.cloudinary.HttpClient$
    at com.cloudinary.Uploader.callApi(Uploader.scala:65)
    at com.cloudinary.Uploader.upload(Uploader.scala:87)
    at com.smartoffice.services.ImageService$$anonfun$uploadImage$1.apply(ImageService.scala:31)
    at com.smartoffice.services.ImageService$$anonfun$uploadImage$1.apply(ImageService.scala:30)
    at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:253)
    at scala.concurrent.Future$$anonfun$flatMap$1.apply(Future.scala:251)
    at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
    at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
    at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

Code:


  val path = s"temp/$folder/${imageRequest.metadata.fileName}"
    val file = new File(path)
    file.getParentFile.mkdirs()

    processFile(path, imageRequest.byteSource).flatMap { _ =>
      cloudinary.uploader().upload(path).map { thing =>
        ImageResponse(thing.url)
      }
    }

The file exists and is readable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.