Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
com.cloudinary:kotlin-uploader
Advanced tools
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.
The Cloudinary Kotlin SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize and transform your cloud's assets.
This Readme provides basic installation and usage information. For the complete documentation, see the Kotlin SDK Guide.
SDK Version | Kotlin Version |
---|---|
1.x | > 1.0 |
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>
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>")
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
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
}
}
If you run into an issue or have a question, you can either:
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.
Released under the MIT license.
FAQs
Unknown package
We found that com.cloudinary:kotlin-uploader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.