Skip to content

Instantly share code, notes, and snippets.

@charlesroper
Last active October 16, 2022 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlesroper/1a4e96542b368143de6734050acd38f5 to your computer and use it in GitHub Desktop.
Save charlesroper/1a4e96542b368143de6734050acd38f5 to your computer and use it in GitHub Desktop.
Screenpresso TEST.cs
// Version: 1
// ScriptName: TEST
// Compiler: C#
// References: System.dll;System.Xml.dll;System.Windows.Forms.dll;CloudinaryDotNet.dll; CloudinaryDotNet.Actions.dll; dotenv.net
// SupportedMedias: Image, AcceptsMultipleFiles
// AutoRun: False
// MaxExecutionTime: 180
namespace Script
{
using System;
using System.Windows.Forms;
using CloudinaryDotNet;
using CloudinaryDotNet.Actions;
using dotenv.net;
public class MyScript
{
public void Execute(string[] filePaths, Form parent)
{
DotEnv.Load(options: new DotEnvOptions(probeForEnv: true));
Cloudinary cloudinary = new Cloudinary(cloudinaryUrl: Environment.GetEnvironmentVariable("CLOUDINARY_URL"));
cloudinary.Api.Secure = true;
foreach (string filePath in filePaths)
{
var uploadParams = new ImageUploadParams()
{
File = new FileDescription(filePath),
UseFilename = true,
UniqueFilename = false,
Overwrite = true,
UploadPreset = "Obsidian"
};
var uploadResult = cloudinary.Upload(uploadParams);
MessageBox.Show(uploadResult.JsonObj, "Script");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment