Last active
October 16, 2022 13:28
-
-
Save charlesroper/1a4e96542b368143de6734050acd38f5 to your computer and use it in GitHub Desktop.
Screenpresso TEST.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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