### Install React Starter Kit Source: https://cloudinary.com/documentation/react_starter_kit Use this command to install the React Starter Kit from npm. The CLI will guide you through project setup, including Cloudinary configuration and AI assistant integration. ```bash npx create-cloudinary-react ``` -------------------------------- ### Install iOS SDK Dependencies Source: https://cloudinary.com/documentation/ios_sample_projects Run this command in the `Example` directory of the cloned iOS SDK repository to install necessary dependencies. ```bash pod install ``` -------------------------------- ### Get Upload Preset Example Source: https://cloudinary.com/documentation/admin_api Example of retrieving details for the 'remote_media' upload preset in various languages and CLI. ```curl curl https://:@api.cloudinary.com/v1_1//upload_presets/remote_media ``` ```ruby result = Cloudinary::Api .upload_preset('remote_media') ``` ```php $result = $api ->uploadPreset("remote_media"); ``` ```python result = cloudinary.api\ .upload_preset("remote_media") ``` ```nodejs cloudinary.v2.api .upload_preset('remote_media') .then(result=>console.log(result)); ``` ```java result = api .uploadPreset("remote_media", ObjectUtils.emptyMap()); ``` ```csharp result = cloudinary .GetUploadPreset("remote_media"); ``` ```go resp, err := cld.Admin.GetUploadPreset(ctx, admin.GetUploadPresetParams{Name: "remote_media"}) ``` ```cli cld admin upload_preset "remote_media" ``` -------------------------------- ### Install Dependencies Source: https://cloudinary.com/documentation/profile_picture_sample_project Install project dependencies using npm. This command should be run before starting the development server. ```bash npm i ``` -------------------------------- ### Full Example: Advanced Zoom Setup Source: https://cloudinary.com/documentation/video_player_interactive_videos This comprehensive example includes HTML for the video player element and JavaScript for player initialization, source definition, and advanced zoom configuration. ```html ``` ```javascript const player = cloudinary.videoPlayer('player', { cloudName: 'demo' bigPlayButton: false }); const sources = { top:'https://res.cloudinary.com/demo/video/upload/docs/my_video_top_zoom.mp4', middle:'https://res.cloudinary.com/demo/video/upload/docs/my_video_middle_zoom.mp4', bottom:'https://res.cloudinary.com/demo/video/upload/docs/my_video_bottom_zoom.mp4' } player.source('my_video', { interactionAreas: { enable: true, template: 'portrait', onClick: function(event) { event.zoom(sources[event.item.id]); } } }); ``` -------------------------------- ### Main function for Cloudinary Go SDK Quickstart Source: https://cloudinary.com/documentation/go_quick_start This is the main entry point for the Go quickstart application. It initializes Cloudinary credentials and calls functions for uploading, getting asset info, and transforming an image. ```go func main() { cld, ctx := credentials() uploadImage(cld, ctx) getAssetInfo(cld, ctx) transformImage(cld, ctx) } ``` -------------------------------- ### Get Transformations (CLI Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using the Cloudinary CLI. The command accepts options for customization. ```cli cld admin transformations ``` -------------------------------- ### Get Product Environments (Syntax Examples) Source: https://cloudinary.com/documentation/provisioning_api_1 Provides syntax for retrieving product environments across multiple programming languages and the command-line interface. ```csharp account.SubAccounts(ListSubAccountsParams parameters); ``` ```ruby Cloudinary::AccountApi.sub_accounts(enabled = nil, ids = [], prefix = nil, options = {}) ``` ```java account.subAccounts(Boolean enabled, List ids, String prefix, Map options); ``` ```nodejs cloudinary.provisioning.account.sub_accounts(boolean enabled, string[] ids, string prefix, object options); ``` ```php $account = new \Cloudinary\Api\Provisioning\AccountApi(); $account->subAccounts(bool $enabled = null, array $ids = [], string $prefix = null); ``` ```python cloudinary.provisioning.account.sub_accounts(enabled=None, ids=None, prefix=None, **options) ``` ```cli cld provisioning sub_accounts [$enabled] [$ids] [$prefix] [$options] ``` -------------------------------- ### Run the Node.js Application Source: https://cloudinary.com/documentation/authentication_signatures Start the Node.js server for the signed uploads examples. This command initiates the server, which will then be accessible via http://localhost:3000. ```terminal node signed-uploads/app.js ``` -------------------------------- ### Get Transformation by Parameters Example Source: https://cloudinary.com/documentation/admin_api Examples of retrieving a transformation by specifying parameters using various SDKs and cURL. ```ruby result = Cloudinary::Api .transformation(width: 150, height: 100, crop: "fill") ``` ```php $result = $api ->transformation(["width" => 150, "height" => 100, "crop" => "fill"]); ``` ```python result = cloudinary.api .transformation(dict(width = 150, height = 100, crop = "fill")) ``` ```javascript cloudinary.v2.api .transformation({width: 150, height: 100, crop: 'fill'}) .then(result=>console.log(result)); ``` ```java result = api .transformation(new Transformation().width(150).height(100). crop("fill").generate(), ObjectUtils.emptyMap()); ``` ```curl curl https://:@api.cloudinary.com/v1_1//transformations/c_fill,h_100,w_150 ``` ```cli cld admin transformation '{"width": 500, "height": 100, "crop": "fill"}' ``` -------------------------------- ### Get Specific Streaming Profile Details Example (Multiple Languages) Source: https://cloudinary.com/documentation/admin_api Example of how to fetch details for a specific streaming profile, such as 'custom_square'. Includes examples for Ruby, PHP, Python, Node.js, Java, C#, Go, cURL, and CLI. ```ruby result = Cloudinary::Api .get_streaming_profile('custom_square') ``` ```php $result = $api ->getStreamingProfile("custom_square"); ``` ```python result = cloudinary.api\ .get_streaming_profile("custom_square") ``` ```nodejs cloudinary.v2.api .get_streaming_profile('custom_square') .then(result=>console.log(result)); ``` ```java result = api .getStreamingProfile("custom_square"); ``` ```csharp result = cloudinary .GetStreamingProfile("custom_square") ``` ```go resp, err := cld.Admin.GetStreamingProfile(ctx, admin.GetStreamingProfileParams{Name: "custom_square"}) ``` ```curl curl https://:@api.cloudinary.com/v1_1//streaming_profiles/custom_square ``` ```cli cld admin get_streaming_profile "custom_square" ``` -------------------------------- ### Queues Start Event Example Source: https://cloudinary.com/documentation/upload_widget_reference Example structure for the 'queues-start' event, which is fired just before files begin uploading. This event signals the initiation of the upload queue. ```js result = { event: "queues-start" }; ``` -------------------------------- ### Get Videos by Contextual Metadata Key and Value (SDKs and CLI) Source: https://cloudinary.com/documentation/admin_api Examples for retrieving video resources by contextual metadata key and value using various SDKs and the command-line interface. ```ruby result = Cloudinary::Api .resources_by_context('mycontextkey', 'mycontextvalue', resource_type: "video") ``` ```php $result = $api ->assetsByContext("mycontextkey", "mycontextvalue" ["resource_type" => "video"]); ``` ```python result = cloudinary.api\ .resources_by_context("mycontextkey", "mycontextvalue" resource_type = "video") ``` ```nodejs cloudinary.v2.api .resources_by_context("mycontextkey", "mycontextvalue", { resource_type: 'video'}) .then(result=>console.log(result)); ``` ```java result = api.resourcesByContext("mycontextkey", "mycontextvalue", ObjectUtils.asMap("resource_type", "video")); ``` ```csharp Not supported by this SDK ``` ```go resp, err := cld.Admin.AssetsByContext(ctx, admin.AssetsByContextParams{ Key: "mycontextkey", Value: "mycontextvalue", DeliveryType: "video"}) ``` ```cli cld admin resources_by_context "mycontextkey" value="mycontextvalue" resource_type="video" ``` -------------------------------- ### Mixing Audio Tracks with C# SDK Source: https://cloudinary.com/documentation/audio_transformations This C# example demonstrates overlaying audio tracks and setting a start offset for the second track. ```csharp cloudinary.Api.UrlVideoUp.Transform(new Transformation() .Overlay(new Layer().PublicId("audio:docs:franck:audio:piano_high")).Chain() .Flags("layer_apply").Chain() .Overlay(new Layer().PublicId("audio:docs:franck:audio:violin_start0")).Chain() .Flags("layer_apply").StartOffset("2.0")).BuildImageTag("docs/franck/audio/piano_low") ``` -------------------------------- ### Mixing Audio Tracks with Java SDK Source: https://cloudinary.com/documentation/audio_transformations This Java example demonstrates overlaying audio tracks and setting a start offset for the second track. ```java cloudinary.url().transformation(new Transformation() .overlay(new Layer().publicId("audio:docs:franck:audio:piano_high")).chain() .flags("layer_apply").chain() .overlay(new Layer().publicId("audio:docs:franck:audio:violin_start0")).chain() .flags("layer_apply").startOffset("2.0")).resourceType("video").imageTag("docs/franck/audio/piano_low"); ``` -------------------------------- ### List all video assets in a product environment Source: https://cloudinary.com/documentation/permissions_assign_roles_api Example of a GET request to list all video assets within a specific product environment using the Admin API. ```HTTP GET https://api.cloudinary.com/v1_1/cld-docs/resources/video ``` -------------------------------- ### Get Users by Prefix (Multiple Languages) Source: https://cloudinary.com/documentation/provisioning_api_1 Filter users by a name prefix. This example demonstrates how to retrieve users whose names start with 'john'. ```csharp var listUsersParams = new ListUsersParams{ Prefix = "john" }; account.Users(listUsersParams); ``` ```ruby Cloudinary::AccountApi.users(nil, [], "john") ``` ```java account.users(null, null, "john", null); ``` ```nodejs cloudinary.provisioning.account.users(null, null, "john") .then((response) => { console.log(response); }) .catch((err) => { console.log(err); }); ``` ```php $account = new \Cloudinary\Api\Provisioning\AccountApi(); $account->users(null, [], "john", null); ``` ```python cloudinary.provisioning.account.users(prefix = "john") ``` ```curl curl \ -H "Content-Type: application/json" \ -d '{ "prefix": "john" }' \ https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/users ``` ```cli cld provisioning users prefix="john" ``` -------------------------------- ### Run Ruby Quickstart Script Source: https://cloudinary.com/documentation/ruby_rails_quickstart Execute the `quickstart.rb` script from your terminal to see Cloudinary SDK in action. Ensure you are in the `/scripts` folder of your project. ```ruby ruby quickstart.rb ``` -------------------------------- ### Get Images by Contextual Metadata Key (SDKs and CLI) Source: https://cloudinary.com/documentation/admin_api Examples for retrieving image resources by contextual metadata key using various SDKs and the command-line interface. ```ruby result = Cloudinary::Api .resources_by_context('mycontextkey') ``` ```php $result = $api ->assetsByContext("mycontextkey"); ``` ```python result = cloudinary.api\ .resources_by_context("mycontextkey") ``` ```nodejs cloudinary.v2.api .resources_by_context("mycontextkey") .then(result=>console.log(result)); ``` ```java result = api .resourcesByContext("mycontextkey", ObjectUtils.emptyMap()); ``` ```csharp Not supported by this SDK ``` ```go resp, err := cld.Admin.AssetsByContext(ctx, admin.AssetsByContextParams{ Key: "mycontextkey"}) ``` ```cli cld admin resources_by_context "mycontextkey" ``` -------------------------------- ### Get Transformation by Name Example Source: https://cloudinary.com/documentation/admin_api Examples of retrieving a transformation by its name using various SDKs and cURL. ```ruby result = Cloudinary::Api .transformation('w_150,h_100,c_fill') ``` ```php $result = $api ->transformation("w_150,h_100,c_fill"); ``` ```python result = cloudinary.api .transformation("w_150,h_100,c_fill") ``` ```javascript cloudinary.v2.api .transformation('w_150,h_100,c_fill') .then(result=>console.log(result)); ``` ```java result = api .transformations("w_150,h_100,c_fill", ObjectUtils.emptyMap()); ``` ```csharp result = cloudinary .GetTransform("w_150,h_100,c_fill"); ``` ```go resp, err := cld.Admin.GetTransformation(ctx, admin.GetTransformationParams{Transformation: "w_150,h_100,c_fill"}) ``` ```curl curl https://:@api.cloudinary.com/v1_1//transformations/w_150,h_100,c_fill ``` ```cli cld admin transformation "w_150,h_100,c_fill" ``` -------------------------------- ### Running the Go application Source: https://cloudinary.com/documentation/go_quick_start Execute this command in the terminal to run the Go quickstart program. Ensure you are in the directory containing 'my_file.go'. ```bash go run my_file.go ``` -------------------------------- ### Set up Root Vue Component Source: https://cloudinary.com/documentation/vue_quick_start Configure your main App.vue file to import and render the QuickStart component. This sets up the entry point for displaying the transformed image. ```vue ``` -------------------------------- ### Add Video Overlay with Transformations (PHP) Source: https://cloudinary.com/documentation/video_layers This PHP example shows how to overlay a video with transformations including trim, resize, fade effects, and precise positioning. ```php use Cloudinary\Transformation\Overlay; use Cloudinary\Transformation\VideoEdit; use Cloudinary\Transformation\Resize; use Cloudinary\Transformation\Effect; use Cloudinary\Transformation\Source; use Cloudinary\Transformation\Position; use Cloudinary\Transformation\Gravity; use Cloudinary\Transformation\Compass; (new VideoTag('man_on_phone.mp4')) ->overlay(Overlay::source( Source::video("man_talking") ->transformation((new Transformation()) ->videoEdit(VideoEdit::trim()->duration(7.5)) ->resize(Resize::scale()->width(500)) ->effect(Effect::fadeIn()->duration(1000)) ->effect(Effect::fadeOut()->duration(1000))) ) ->position((new Position()) ->gravity( Gravity::compass( Compass::southEast())) ) ->timeline( Timeline::position()->startOffset(2.5)) ); ``` -------------------------------- ### List Metadata Rules (Example) Source: https://cloudinary.com/documentation/conditional_metadata_rules_api Use this GET request to list all metadata rules in your Cloudinary product environment. Replace 'demo' with your actual cloud name. ```http GET https://api.cloudinary.com/v1_1/demo/metadata_rules ``` -------------------------------- ### Initialize and Tidy Go Modules Source: https://cloudinary.com/documentation/go_media_transformations Initialize the Go module for the project and tidy dependencies. Use 'go-sdk-quickstart-video-examples' for the video app. ```Terminal go mod init go-sdk-quickstart-image-examples go mod tidy ``` -------------------------------- ### Swift: Conditional transformation setup Source: https://cloudinary.com/documentation/conditional_transformations Initializes a Cloudinary URL with transformation settings, including conditional logic. This is a setup example. ```swift cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation() ``` -------------------------------- ### Get Users in a User Group (Example) Source: https://cloudinary.com/documentation/provisioning_api_1 Example of retrieving users from a user group with a specific ID. This demonstrates practical usage. ```csharp account.UsersGroupUsers("7f08f1f1fc910bf1f25274aef11d27"); ``` ```ruby Cloudinary::AccountApi.user_group_users("7f08f1f1fc910bf1f25274aef11d27") ``` ```java account.userGroupUsers("7f08f1f1fc910bf1f25274aef11d27"); ``` ```nodejs cloudinary.provisioning.account.user_group_users("7f08f1f1fc910bf1f25274aef11d27") .then((response) => { console.log(response); }) .catch((err) => { console.log(err); }); ``` ```php_2 $account = new \Cloudinary\Api\Provisioning\AccountApi(); $account->userGroupUsers("7f08f1f1fc910bf1f25274aef11d27"); ``` ```python cloudinary.provisioning.account.user_group_users("7f08f1f1fc910bf1f25274aef11d27") ``` ```curl curl https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/user_groups/7f08f1f1fc910bf1f25274aef11d27/users ``` ```cli cld provisioning user_group_users "7f08f1f1fc910bf1f25274aef11d27" ``` -------------------------------- ### Configure Video Player with Recommendations Source: https://cloudinary.com/documentation/video_player_playlists_recommendations Set up video sources with recommendation data and initialize the player to automatically show recommendations. Ensure recommendation sources have titles, subtitles, and descriptions for best results. ```js // Setting video sources: const source1 = { publicId: 'movie1', info: { title: 'My main movie', subtitle: 'Something to know about the main movie' } } const source2 = { publicId: 'movie2', info: { title: 'Another great video', subtitle: 'A great subtitle', description: 'An interesting description of this video....' } } const source3 = { publicId: 'movie3', info: { title: 'Another interesting video1', subtitle: 'Subtitle for video3', description: 'An interesting description of this video....' } } const source4 = { publicId: 'movie4', info: { title: 'Another interesting video2', subtitle: 'Subtitle for video4', description: 'An interesting description of this video....' } } const source5 = { publicId: 'movie5', info: { title: 'Another interesting video3', subtitle: 'Subtitle for video5', description: 'An interesting description of this video....' } } // Specifying the recommendations for source1 as a fixed array of sources: source1.recommendations = [source2, source3, source4, source5] // Initializing the player with recommendations turned on const player = cloudinary.videoPlayer('example-player', { autoShowRecommendations: true }); player.source(source1); ``` -------------------------------- ### JavaScript: Basic Video Transparency Setup Source: https://cloudinary.com/documentation/video_effects_and_enhancements This JavaScript snippet provides the foundational imports for applying video effects, specifically for setting up transparency. It's a starting point for more complex transformations. ```javascript import { scale } from "@cloudinary/url-gen/actions/resize"; ``` -------------------------------- ### Get Transformations (Go Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using the Cloudinary Go SDK. This method requires a context and ListTransformationsParams. ```go resp, err := cld.Admin.ListTransformations(ctx, admin.ListTransformationsParams{}) ``` -------------------------------- ### Get Transformations (C# Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using the Cloudinary C# SDK. This method takes a TransformParams object. ```csharp result = cloudinary .ListTransformations(); ``` -------------------------------- ### Initialize Video Player for Playlist Recommendations Source: https://cloudinary.com/documentation/video_player_playlists_recommendations Set up a video player to display a playlist with recommendations. This example uses `playlistByTag` to fetch videos and configures the playlist widget and source parameters. ```html
``` ```js const player = cloudinary.videoPlayer('doc-player', { cloudName: 'demo', playlistWidget: { direction: 'vertical', total:5 }}).width(600); player.playlistByTag('video_race', { sourceParams: { overlay: "cloudinary_icon_white", opacity: 80, effect: "brightness:200", width: 100, gravity: "north_east", x: 20, y: 10 }, autoAdvance: 0, repeat: true, presentUpcoming: 5 }) ``` -------------------------------- ### Get Transformations (Node.js Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using the Cloudinary Node.js SDK. This method can accept options for pagination and filtering. ```nodejs cloudinary.v2.api .transformations() .then(result=>console.log(result)); ``` -------------------------------- ### Run PHP Quickstart Script Source: https://cloudinary.com/documentation/php_quickstart Execute the PHP script from the terminal to see the output of the Cloudinary SDK operations. ```bash php php_quickstart.php ``` -------------------------------- ### Overlay Subtitles with Custom Colors (Example) Source: https://cloudinary.com/documentation/video_layers Example demonstrating how to overlay subtitles with custom text and background colors. Supports hex, named, and RGBA color formats. ```text For example, to overlay the subtitles in the `outdoors.vtt` file using the Arial font with a size of 40 pixels, in yellow text (FFFF00) with a black background: ``` -------------------------------- ### Create Sub-Account Example Source: https://cloudinary.com/documentation/provisioning_api_1 Demonstrates how to create a new sub-account named 'demo account' using various SDKs and cURL. ```csharp var createSubAccountParams = new CreateSubAccountParams("demo account"); account.CreateSubAccount(createSubAccountParams); ``` ```ruby Cloudinary::AccountApi.create_sub_account("demo account") ``` ```java account.createSubAccount("demo account", null, ObjectUtils.emptyMap(), null); ``` ```nodejs cloudinary.provisioning.account.create_sub_account("demo account") .then((response) => { console.log(response); }) .catch((err) => { console.log(err); }); ``` ```php $account = new \Cloudinary\Api\Provisioning\AccountApi(); $account->createSubAccount("demo account", null, null, false, null); ``` ```python cloudinary.provisioning.account.create_sub_account("demo account") ``` ```curl curl \ -H "Content-Type: application/json" \ -d '{ "name": "demo account" }' \ -X POST \ https://:@api.cloudinary.com/v1_1/provisioning/accounts/16a8ff3b-736b-49a6-85c0-03b69d5a357b/sub_accounts ``` ```cli cld provisioning create_sub_account "demo account" ``` -------------------------------- ### Get Transformations (Python Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using the Cloudinary Python SDK. This method can accept options for pagination and filtering. ```python result = cloudinary.api\ .transformations() ``` -------------------------------- ### Add Video Overlay with Transformations (Kotlin) Source: https://cloudinary.com/documentation/video_layers This Kotlin example demonstrates creating a video with an overlay and applying transformations like duration, resizing, fade effects, and precise positioning. ```kotlin cloudinary.video { publicId("man_on_phone.mp4") overlay(Overlay.source( Source.video("man_talking") { transformation(Transformation { videoEdit(VideoEdit.trim() { duration(7.5F) }) resize(Resize.scale() { width(500) }) effect(Effect.fadeIn() { duration(1000) }) effect(Effect.fadeOut() { duration(1000) }) }) }) { position(Position() { gravity( Gravity.compass( Compass.southEast())) }) timeline( Timeline.position() { startOffset(2.5F) }) }) }.generate() ``` -------------------------------- ### Get Transformations (PHP Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using the Cloudinary PHP SDK. This method can accept options for pagination and filtering. ```php $result = $api ->transformations(); ``` -------------------------------- ### Apply Overlay and Transformations to Video Source: https://cloudinary.com/documentation/video_layers Overlay an image with transformations onto a video. This example shows how to adjust opacity, brightness, and position of the overlay. ```javascript cloudinary.video('docs/mountain-aerial-view.mp4').opacity(70).chain() .effect("brightness:50").chain() .flags("layer_apply").gravity("north_east")).resourceType("video").generate("docs/mountain-aerial-view.mp4"); ``` ```flutter cloudinary.video('docs/mountain-aerial-view.mp4').transformation(Transformation() .overlay(Overlay.source( Source.image("cloudinary_icon_blue") .transformation(new Transformation() .resize(Resize.scale().width(0.5)) .adjust(Adjust.opacity(70)) .adjust(Adjust.brightness().level(50))) ) .position(Position() .gravity( Gravity.compass( Compass.northEast())) ) )); ``` ```kotlin cloudinary.video { publicId("docs/mountain-aerial-view.mp4") overlay(Overlay.source( Source.image("cloudinary_icon_blue") { transformation(Transformation { resize(Resize.scale() { width(0.5F) }) adjust(Adjust.opacity(70)) adjust(Adjust.brightness() { level(50) }) }) }) { position(Position() { gravity( Gravity.compass( Compass.northEast())) }) }) }.generate() ``` ```jquery $.cloudinary.video("docs/mountain-aerial-view", {transformation: [ {overlay: new cloudinary.Layer().publicId("cloudinary_icon_blue")}, {width: "0.5", crop: "scale"}, {opacity: 70}, {effect: "brightness:50"}, {flags: "layer_apply", gravity: "north_east"} ]}) ``` ```react_native new CloudinaryVideo("docs/mountain-aerial-view.mp4").overlay( source( image("cloudinary_icon_blue").transformation( new Transformation() .resize(scale().width(0.5)) .adjust(opacity(70)) .adjust(brightness().level(50)) ) ).position(new Position().gravity(compass("north_east"))) ); ``` -------------------------------- ### Crop Video using Cloudinary SDKs Source: https://cloudinary.com/documentation/video_resizing_and_cropping These examples demonstrate how to use the Cloudinary SDKs to crop videos to specified dimensions with north gravity. Ensure you have the necessary SDKs installed and imported. ```react import { crop } from "@cloudinary/url-gen/actions/resize"; import { compass } from "@cloudinary/url-gen/qualifiers/gravity"; new CloudinaryVideo("docs/woman-camera-portrait.mp4").resize( crop() .width(500) .height(1000) .gravity(compass("north")) ); ``` ```vue import { crop } from "@cloudinary/url-gen/actions/resize"; import { compass } from "@cloudinary/url-gen/qualifiers/gravity"; new CloudinaryVideo("docs/woman-camera-portrait.mp4").resize( crop() .width(500) .height(1000) .gravity(compass("north") )); ``` ```angular import { crop } from "@cloudinary/url-gen/actions/resize"; import { compass } from "@cloudinary/url-gen/qualifiers/gravity"; new CloudinaryVideo("docs/woman-camera-portrait.mp4").resize( crop() .width(500) .height(1000) .gravity(compass("north") )); ``` ```js import { crop } from "@cloudinary/url-gen/actions/resize"; import { compass } from "@cloudinary/url-gen/qualifiers/gravity"; new CloudinaryVideo("docs/woman-camera-portrait.mp4").resize( crop() .width(500) .height(1000) .gravity(compass("north") )); ``` ```dart cloudinary.video('docs/woman-camera-portrait.mp4').transformation(Transformation() .resize(Resize.crop().width(500) .height(1000) .gravity( Gravity.compass( Compass.north())) )); ``` ```flutter cloudinary.video('docs/woman-camera-portrait.mp4').transformation(Transformation() .resize(Resize.crop().width(500) .height(1000) .gravity( Gravity.compass( Compass.north())) )); ``` ```react_native import { crop } from "@cloudinary/url-gen/actions/resize"; import { compass } from "@cloudinary/url-gen/qualifiers/gravity"; new CloudinaryVideo("docs/woman-camera-portrait.mp4").resize( crop() .width(500) .height(1000) .gravity(compass("north") )); ``` -------------------------------- ### Initialize Cloudinary Go SDK Source: https://cloudinary.com/documentation/go_integration Import necessary packages and initialize the Cloudinary SDK with your cloud credentials. This setup is required before performing any Cloudinary operations. ```go import ( "context" "log" "github.com/cloudinary/cloudinary-go/v2" "github.com/cloudinary/cloudinary-go/v2/api" "github.com/cloudinary/cloudinary-go/v2/api/admin" "github.com/cloudinary/cloudinary-go/v2/api/uploader" ) func main() { // Replace with your actual cloud name, API key, and API secret cloudName := "your_cloud_name" apiKey := "your_api_key" apiSecret := "your_api_secret" // Initialize Cloudinary SDK cld, err := cloudinary.NewFromParams(cloudName, apiKey, apiSecret) if err != nil { log.Fatalf("Failed to create Cloudinary instance: %v", err) } // You can now use 'cld' for API calls ctx := context.Background() _ = ctx // Use ctx for API calls // Example: Using admin API (replace with actual admin operation) // _, err = cld.Admin.GetAssetInfo("sample_public_id", admin.PublicIDOpt.PublicID("sample_public_id")) // if err != nil { // log.Printf("Error getting asset info: %v", err) // } // Example: Using uploader API (replace with actual upload operation) // resp, err := cld.Upload.UploadFromBytes(ctx, uploader.UploadParams{File: api.String("path/to/your/image.jpg")}) // if err != nil { // log.Printf("Error uploading file: %v", err) // } // log.Printf("Upload response: %+v\n", resp) } ``` -------------------------------- ### Get Transformations (Ruby Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using the Cloudinary Ruby SDK. This method can accept options for pagination and filtering. ```ruby result = Cloudinary::Api .transformations ``` -------------------------------- ### Get Transformations (cURL Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using a cURL command. Replace placeholders with your API key, secret, and cloud name. ```curl curl https://:@api.cloudinary.com/v1_1//transformations ``` -------------------------------- ### Run Development Server Source: https://cloudinary.com/documentation/try_before_you_buy_sample_project Install dependencies and run the development server to launch the application locally. ```bash npm i npm run dev ``` -------------------------------- ### Example: Setting Bitrate Source: https://cloudinary.com/documentation/sdks/js/transformation-builder/Actions.Transcode.html Demonstrates how to control the video bitrate using the `bitRate` action. ```APIDOC ## Example: Setting Bitrate ```javascript import { Cloudinary } from "@cloudinary/url-gen/instance/Cloudinary"; import { bitRate } from '@cloudinary/url-gen/actions/transcode'; const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}}); const video = yourCldInstance.video('dog'); video.transcode( bitRate(500).constant() ); ``` ``` -------------------------------- ### Get Transformations (Java Example) Source: https://cloudinary.com/documentation/admin_api Example of listing all transformations using the Cloudinary Java SDK. This method can accept an empty map for default options. ```java result = api .transformations(ObjectUtils.emptyMap()); ``` -------------------------------- ### Scale Down and Pad Video with Aspect Ratio (Java) Source: https://cloudinary.com/documentation/video_resizing_and_cropping Java code example for generating a video URL with transformations for aspect ratio, padding, and width. ```java cloudinary.url().transformation(new Transformation().aspectRatio("0.66").background("green").width(100).crop("lpad")).imageTag("docs/camera.jpg"); ``` -------------------------------- ### Add Underlay to Image (Kotlin) Source: https://cloudinary.com/documentation/video_layers A Kotlin example for adding an underlay to an image. It configures transformations for resizing, underlay, and effects. ```kotlin cloudinary.image { publicId("smartphone.png") resize(Resize.fill() { width(200) height(200) }) underlay(Underlay.source( Source.image("site_bg") { transformation(Transformation { resize(Resize.scale() { width(200) height(200) }) adjust(Adjust.brightness() { level(100) }) }) }) }.generate() ``` -------------------------------- ### Timed Text Overlays with Start and End Offsets Source: https://cloudinary.com/documentation/video_layers Demonstrates four back-to-back text overlays, each with a specific duration controlled by start and end offsets. Use this for precise timing of text elements. ```text l_text:Arial_34_bold:First%20text/fl_layer_apply,g_west,x_10,eo_3/ l_text:Arial_34_bold:Second%20text/fl_layer_apply,g_west,x_10,so_3,eo_6/ l_text:Arial_34_bold:Third%20text/fl_layer_apply,g_west,x_10,so_6,eo_9/ l_text:Arial_34_bold:Fourth%20text/fl_layer_apply,g_west,x_10,so_9,eo_12 ``` -------------------------------- ### Install Angular 5.x SDK via npm Source: https://cloudinary.com/documentation/angular1_integration Example of installing the Cloudinary SDK specifically for Angular versions 5 through 13 using npm. ```bash npm install cloudinary-core @cloudinary/angular-5.x ``` -------------------------------- ### Swift Video with Audio Description Source: https://cloudinary.com/documentation/accessible_media_video_audio Swift example using `createUrl` with `setTransformation` and `setOverlay` for audio descriptions. ```swift cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation() .setOverlay("audio:docs:grocery-audio-description")).chain() .setFlags("layer_apply")).generate("docs/grocery-store-no-audio.mp4") ``` -------------------------------- ### Video Overlay URL Example Source: https://cloudinary.com/documentation/video_layers Example of a Cloudinary URL for a video overlay with specific timing, scaling, fade effects, and placement. ```URL https://res.cloudinary.com/demo/video/upload/l_video:man_talking/du_7.5/c_scale,w_500/e_fade:1000/e_fade:-1000/fl_layer_apply,g_south_east,so_2.5/man_on_phone.mp4 ``` -------------------------------- ### Video Player Instance Methods Chaining Example Source: https://cloudinary.com/documentation/video_player_api_reference Demonstrates chaining multiple instance methods for playlist creation, playback, muting, transformation, and source setting. ```APIDOC ## Instance Methods Chaining Examples ### Playlist and Playback ```js vplayer.playlist(['mymovie', 'movie2', 'movie3' ], { autoAdvance: 0 }).play() ``` ### Mute, Transformation, Source, and Play ```js vplayer.mute().transformation({ effect: ["sepia"]} ).source(...).play() ``` ``` -------------------------------- ### Example Download Backup URL Source: https://cloudinary.com/documentation/backups_and_version_management This is an example of a URL generated by the SDKs to download a backed-up asset version. The URL is valid for one hour. ```text https://api.cloudinary.com/v1_1/demo/download_backup?timestamp=173719931&asset_id=62c2a18d622be7e190d21df8e05b1416&version_id=26fe6d95df856f6ae12f5678be94516a&signature=c9937fe93eb655ce04633034f921b83969eff9aa&api_key=323127161127519 ``` -------------------------------- ### Get diagonalDesc GradientDirection Source: https://cloudinary.com/documentation/sdks/dart/url-gen/transformation_background_border_gradient_background/GradientDirection/diagonalDesc.html Use this static method to get the diagonal_desc gradient direction. No specific setup or imports are required beyond the GradientDirection class itself. ```dart static GradientDirection diagonalDesc() { return GradientDirection('diagonal_desc'); } ``` -------------------------------- ### Install the Cloudinary Go SDK Source: https://cloudinary.com/documentation/go_configuration_tutorial Use this command to add the Cloudinary Go library to your project. Ensure you are in your Go module's directory. ```go go get github.com/cloudinary/cloudinary-go/v2 ``` -------------------------------- ### Flyout Zoom Configuration Example Source: https://cloudinary.com/documentation/product_gallery_reference Set up the 'flyout' zoom type for images in the Product Gallery. This example configures zoom level, viewer position, and lens opacity. ```json { type: 'flyout', level: 3, viewerPosition: 'top', lensOpacity: 0.3 } ``` -------------------------------- ### Get Facial Landmark Coordinates (Ruby) Source: https://cloudinary.com/documentation/face_detection_based_transformations Apply face detection and the `getinfo` flag to get facial landmark coordinates in Ruby. This example uses the `cl_image_tag` helper. ```ruby cl_image_tag("docs/plain_face.jpg", transformation: [ {gravity: "face", width: 450, crop: "thumb"}, {flags: "getinfo"} ]) ``` -------------------------------- ### Add Video Overlay with Transformations (Ruby) Source: https://cloudinary.com/documentation/video_layers A Ruby example for generating a video tag with an overlay, including transformations for duration, size, fade effects, and placement. ```ruby cl_video_tag("man_on_phone", transformation: [ {overlay: "video:man_talking"}, {duration: "7.5"}, {width: 500, crop: "scale"}, {effect: "fade:1000"}, {effect: "fade:-1000"}, {flags: "layer_apply", gravity: "south_east", start_offset: "2.5"} ]) ``` -------------------------------- ### Add Video Overlay with Transformations (Swift) Source: https://cloudinary.com/documentation/video_layers This Swift example demonstrates generating a video URL with an overlay and applying transformations like duration, scaling, fade effects, and positioning. ```swift cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation() .setOverlay("video:man_talking").chain() .setDuration("7.5").chain() .setWidth(500).setCrop("scale").chain() .setEffect("fade:1000").chain() .setEffect("fade:-1000").chain() .setFlags("layer_apply").setGravity("south_east").setStartOffset("2.5")).generate("man_on_phone.mp4") ``` -------------------------------- ### Run SvelteKit Application Source: https://cloudinary.com/documentation/javascript_configuration_in_svelte_tutorial Start your SvelteKit development server. This command is used to run the sample application locally. ```bash npm run dev ``` -------------------------------- ### Get Facial Landmark Coordinates (Python) Source: https://cloudinary.com/documentation/face_detection_based_transformations Apply face detection to get facial landmark coordinates in Python. This example uses the Cloudinary SDK for image transformations. ```python CloudinaryImage("docs/plain_face.jpg").image(transformation=[ {'gravity': "face", 'width': 450, 'crop': "thumb"}, {'flags': "getinfo"} ]) ``` -------------------------------- ### Add Audio Overlay with Volume Adjustment (Kotlin) Source: https://cloudinary.com/documentation/video_layers Use Kotlin to add audio overlays to videos and adjust their volume. This example demonstrates a fluent API for video transformations. ```kotlin cloudinary.video { publicId("docs/drive-colorful-trees-waterside.mp4") transcode(Transcode.audioCodec( AudioCodec.none())) overlay(Overlay.source( Source.audio("electronic") { transformation(Transformation { videoEdit(VideoEdit.volume(-50)) }) })) }.generate() ``` -------------------------------- ### Cloudinary Transcript File Example Source: https://cloudinary.com/documentation/microsoft_azure_video_indexer_addon Example of a JSON file containing audio transcription details, including confidence, transcript text, start, and end times for each segment. ```json [ { "confidence":0.9312, "transcript":"Many organizations that use cloudinary have thousands if not millions of digital assets stored in their system.", "start_time":7.11, "end_time":15.1 }, { "confidence":0.9312, "transcript":"However, certain users on the account may not need to access all the images videos and raw files. Because of this cloudinary offers the ability to add a layer of", "start_time":15.1, "end_time":26.59 }, ... ] ``` -------------------------------- ### Add Audio Overlay with Volume Adjustment (Java) Source: https://cloudinary.com/documentation/video_layers Configure audio overlays and volume adjustments for videos using the Cloudinary Java SDK. This example chains multiple transformations. ```java cloudinary.url().transformation(new Transformation() .audioCodec("none").chain() .overlay(new Layer().publicId("audio:electronic")).chain() .effect("volume:-50").chain() .flags("layer_apply")).videoTag("docs/drive-colorful-trees-waterside"); ``` -------------------------------- ### Example: Get Subfolders Forbidden Response Source: https://cloudinary.com/documentation/permissions_custom_policies This JSON response illustrates an error when a request to get subfolders is forbidden. It includes an error message detailing the unauthorized access attempt. ```json { "error": { "message": "customer is unauthorized to read one or more of the requested folders" } } ``` -------------------------------- ### Example: Setting FPS Source: https://cloudinary.com/documentation/sdks/js/transformation-builder/Actions.Transcode.html Demonstrates how to set the frames per second (FPS) for a video using the `fps` action. ```APIDOC ## Example: Setting FPS ```javascript import { Cloudinary } from "@cloudinary/url-gen/instance/Cloudinary"; import { fps } from '@cloudinary/url-gen/actions/transcode'; const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}}); const video = yourCldInstance.video('dog'); video.transcode( fps(15) ); ``` ``` -------------------------------- ### Product Gallery JSON Configuration - CNAME Example Source: https://cloudinary.com/documentation/sfcc_developer_guide Example of additional configuration parameters for Product Gallery, specifically for setting up a CNAME. Ensure 'secure' and 'privateCdn' are true, and 'secureDistribution' is set to your custom delivery hostname. ```json "secure": true, "privateCdn":"true", "secureDistribution": "www.example.com", ``` -------------------------------- ### Position Image Overlay with Gravity (Java) Source: https://cloudinary.com/documentation/video_layers Use Java to apply an overlay layer to an image with specific gravity. This example scales the overlay and applies it to the west side. ```java cloudinary.url().transformation(new Transformation() .overlay(new Layer().publicId("lotus_layer")).chain() .flags("layer_apply").gravity("west")).generate("docs/camera.jpg"); ``` -------------------------------- ### Add Audio Overlay with Volume Adjustment (Ruby) Source: https://cloudinary.com/documentation/video_layers Implement audio overlays on videos with volume control using Ruby. This example utilizes the Cloudinary Ruby gem for video transformations. ```ruby cl_video_tag("docs/drive-colorful-trees-waterside", transformation: [ {audio_codec: "none"}, {overlay: "audio:electronic"}, {effect: "volume:-50"}, {flags: "layer_apply"} ]) ``` -------------------------------- ### Get Facial Landmark Coordinates (React Native) Source: https://cloudinary.com/documentation/face_detection_based_transformations Apply face detection to get facial landmark coordinates in React Native. This example requires imports for resize and focusOn qualifiers. ```react_native import { thumbnail } from "@cloudinary/url-gen/actions/resize"; import { focusOn } from "@cloudinary/url-gen/qualifiers/gravity"; ``` -------------------------------- ### Add Audio Overlay with Volume Adjustment (Swift) Source: https://cloudinary.com/documentation/video_layers Use Swift to add audio overlays to videos and control their volume. This example demonstrates chaining transformations with the Cloudinary Swift SDK. ```swift cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation() .setAudioCodec("none").chain() .setOverlay("audio:electronic").chain() .setEffect("volume:-50").chain() .setFlags("layer_apply")).generate("docs/drive-colorful-trees-waterside.mp4") ``` -------------------------------- ### Add Audio Overlay with Volume Adjustment (Python) Source: https://cloudinary.com/documentation/video_layers Apply an audio overlay to a video and control its volume using Python. This example sets the audio codec to 'none' and applies a volume effect. ```python CloudinaryVideo("docs/drive-colorful-trees-waterside").video(transformation=[ {'audio_codec': "none"}, {'overlay': "audio:electronic"}, {'effect': "volume:-50"}, {'flags': "layer_apply"} ]) ``` -------------------------------- ### Get Facial Landmark Coordinates (Swift) Source: https://cloudinary.com/documentation/face_detection_based_transformations Use face detection and the `getinfo` flag to get facial landmark coordinates in Swift. This example configures an image view with Cloudinary transformations. ```swift imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation() .setGravity("face").setWidth(450).setCrop("thumb").chain() .setFlags("getinfo")).generate("docs/plain_face.jpg")!, cloudinary:cloudinary) ``` -------------------------------- ### Create or Replace Video Player Config Example Source: https://cloudinary.com/documentation/video_config_reference Creates or updates the player configuration for a specific video asset. Use this to apply custom player settings to a video. ```json { "playerOptions": { "controls": true, "loop": true, "autoplay": "on-scroll", "colors": { "base": "#1532a8", "accent": "#FF9B00", "text": "#FFFFFF" } }, "sourceOptions": { "sourceTypes": [ "hls" ] } } ``` -------------------------------- ### Kotlin: Remote Image Underlay for Video Source: https://cloudinary.com/documentation/video_layers Configure remote image underlays for videos with the Cloudinary Kotlin SDK. This example uses a DSL for transformations, including nested transformations for the underlay source. ```kotlin cloudinary.video { publicId("docs/transparent_talking.webm") underlay(Underlay.source( Source.fetch("https://res.cloudinary.com/demo/image/upload/site_bg") { transformation(Transformation { resize(Resize.fill() { width(1.0F) height(1.0F) relative() }) }) })) }.generate() ``` -------------------------------- ### Implement ghostWhite Color Source: https://cloudinary.com/documentation/sdks/dart/url-gen/transformation_color/Color/ghostWhite.html Use this method to get a Color object for ghostwhite. No setup is required. ```dart static Color ghostWhite() { return Color('ghostwhite'); } ``` -------------------------------- ### Apply Overlay and Resizing Transformations (C#) Source: https://cloudinary.com/documentation/cloudinary_transformation_rules.md Demonstrates chaining transformations to overlay an image with specific resizing and positioning, then applying it to a video. ```csharp cloudinary.Api.UrlVideoUp.Transform(new Transformation() .Height(200).Width(300).Crop("fill").Chain() .Overlay(new Layer().PublicId("docs:camera")).Chain() .Width(100).Crop("scale").Chain() .Flags("layer_apply").Gravity("south_east").StartOffset("0")).BuildVideoTag("docs/walking_talking") ```