A simple command-line tool to upload images to Cloudinary CDN.
- Upload images to Cloudinary directly from the command line
- Supports various image formats (JPEG, PNG, GIF, etc.)
- Simple and easy to use
-
Clone the repository
git clone <repository-url> cd image-cdn
-
Create a
.envfileCreate a
.envfile in the project root directory with your Cloudinary credentials:CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret
You can find these credentials in your Cloudinary dashboard.
-
Configure an upload preset (optional)
- Go to your Cloudinary Dashboard → Settings → Upload
- Add an upload preset (e.g.,
ml_default) - Set it to "Unsigned" mode for simpler uploads
- Or remove the
upload_presetfrom the code and use signed uploads
Run the uploader with an image path:
cargo run -- <path-to-image># Upload a single image
cargo run -- "C:\Users\ENIGMA\Downloads\photo.jpg"
# On Linux/Mac
cargo run -- "/home/user/images/photo.png"image-cdn/
├── .env # Environment variables (create this)
├── .gitignore # Git ignore rules
├── Cargo.toml # Rust dependencies
├── Cargo.lock # Locked dependencies
├── README.md # This file
└── src/
└── main.rs # Main application code
- reqwest - HTTP client for making requests to Cloudinary
- tokio - Async runtime for Rust
- serde - Serialization/deserialization
- dotenv - Load environment variables from .env file
cargo buildcargo run -- <image-path>cargo build --releaseThe optimized binary will be in target/release/image-cdn.exe.
Make sure your .env file is in the project root directory and contains the correct credentials:
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secretEnsure the image path you provide exists and is accessible.
- Check your Cloudinary credentials
- Verify your upload preset exists and is configured correctly
- Make sure your Cloudinary account has API access enabled
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make your changes and commit them
- Push to your branch:
git push origin feature/my-feature - Create a Pull Request
- Follow Rust's standard coding conventions
- Use
cargo fmtto format code before committing - Use
cargo clippyto check for common mistakes - Add comments for complex logic
MIT License - feel free to use this project for any purpose.
- Cloudinary for their image CDN service
- Rust community for excellent documentation