![JAR search and dependency download from the Maven repository](/logo.png)
com.cloudinary.asset.Image.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-url-gen Show documentation
Show all versions of kotlin-url-gen Show documentation
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.
package com.cloudinary.asset
import com.cloudinary.config.CloudConfig
import com.cloudinary.config.UrlConfig
import com.cloudinary.transformation.Action
import com.cloudinary.transformation.Format
import com.cloudinary.transformation.ITransformable
import com.cloudinary.transformation.ImageTransformation
class Image(
// config
cloudConfig: CloudConfig,
urlConfig: UrlConfig,
// fields
version: String? = null,
publicId: String? = null,
extension: Format? = null,
urlSuffix: String? = null,
deliveryType: String? = null,
private val transformation: ImageTransformation? = null
) : BaseAsset(
cloudConfig,
urlConfig,
version,
publicId,
extension,
urlSuffix,
ASSET_TYPE_IMAGE,
deliveryType
) {
class Builder(cloudConfig: CloudConfig, urlConfig: UrlConfig) :
BaseAssetBuilder(cloudConfig, urlConfig, ASSET_TYPE_IMAGE), ITransformable {
private var transformation: ImageTransformation? = null
fun transformation(transformation: ImageTransformation) = apply { this.transformation = transformation }
fun transformation(transform: ImageTransformation.Builder.() -> Unit) = apply {
val builder = ImageTransformation.Builder()
builder.transform()
this.transformation = builder.build()
}
override fun add(action: Action) = apply {
this.transformation = (this.transformation ?: ImageTransformation()).add(action)
}
fun build() = Image(
cloudConfig,
urlConfig,
version,
publicId,
extension,
urlSuffix,
deliveryType,
transformation
)
}
override fun getTransformationString() = transformation?.toString()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy