You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

com.cloudinary:kotlin-url-gen

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.cloudinary:kotlin-url-gen

Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline. 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. This Java library allows to easily integrate with Cloudinary in Kotlin applications.


Version published
Maintainers
1

Readme

Source

Cloudinary Kotlin SDK

Build Status

About

The Cloudinary Kotlin SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize and transform your cloud's assets.

Additional documentation

This Readme provides basic installation and usage information. For the complete documentation, see the Kotlin SDK Guide.

Table of Contents

Key Features

Version Support

SDK VersionKotlin Version
1.x> 1.0

Installation

Add the SDK to your project as a dependency, we recommend using a build management tool such as Maven or Gradle to do this.

Using Gradle:

Add the Cloudinary Kotlin SDK to the dependencies section of your build.gradle file.

implementation 'com.cloudinary:kotlin-url-gen:1.9.0'

Using Maven:

Add the Cloudinary Kotlin SDK to the list of dependencies in your pom.xml file.

<dependency>
  <groupId>com.cloudinary</groupId>
  <artifactId>kotlin-url-gen</artifactId>
  <version>1.9.0</version>
  <type>pom</type>
</dependency>

Usage

Setup

The Cloudinary class is the main entry point for using the library. Your cloud_name is required to create an instance of this class. Your api_key and api_secret are also needed to perform secure API calls to Cloudinary (e.g., image and video uploads). Setting the configuration parameters can be done either programmatically using an appropriate constructor of the Cloudinary class or globally using an environment variable. You can find your account-specific configuration parameters in the Dashboard page of your account console.

Here's an example of setting configuration parameters in your Kotlin application:

import com.cloudinary.*

...
private val cloudinary = Cloudinary("cloudinary://<your-api-key>:<your-api-secret>@<your-cloud-name>")

Transform and Optimize Assets

Generate a Cloudinary URL using the cloudinary.media helper method and pass this to your image or video view:

For example, to generate a url for an image called sample on the demo account, and resize it using the fill method:

A transformation is also added to the image - cropping and using the sepia effect:

 val cloudinary = Cloudinary("cloudinary://@demo")
 val url = cloudinary.image {
   publicId("sample")
   resize(Resize.fill {
     width(100)
     height(150)
   })
 }
 println(url.generate())

This will output the following url: https://res.cloudinary.com/demo/image/upload/c_fill,h_150,w_100/sample.jpg

Uploading Assets

To upload a file you need to call you cloudinary object with uploader(), here's an example:

cloudinary.uploader().upload(imageFile) { 
    params {
      uploadPreset = "sample_preset"
    }
    options {
      unsigned = true
    }
}

Contributions

See contributing guidelines.

Get Help

If you run into an issue or have a question, you can either:

About Cloudinary

Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device.

Additional Resources

Licence

Released under the MIT license.

FAQs

Package last updated on 14 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc