Added new readme & .net10 support

This commit is contained in:
iminet
2026-09-27 10:50:23 +02:00
parent 0b16a55693
commit 08a6f61c9f
2 changed files with 127 additions and 8 deletions
+3 -2
View File
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net5.0;net6.0;net7.0;net8.0</TargetFrameworks> <TargetFrameworks>net5.0;net6.0;net7.0;net8.0;net10.0</TargetFrameworks>
<Nullable>disable</Nullable> <Nullable>disable</Nullable>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>ImgBBApi</RootNamespace> <RootNamespace>ImgBBApi</RootNamespace>
<AssemblyName>ImgBBApi</AssemblyName> <AssemblyName>ImgBBApi</AssemblyName>
<PackageReleaseNotes>Added package icon</PackageReleaseNotes> <PackageReleaseNotes>Added package icon</PackageReleaseNotes>
<Deterministic>False</Deterministic> <Deterministic>False</Deterministic>
<AssemblyVersion>1.0.3</AssemblyVersion> <AssemblyVersion>1.0.4</AssemblyVersion>
<Version>$(AssemblyVersion)</Version> <Version>$(AssemblyVersion)</Version>
<FileVersion>$(AssemblyVersion)</FileVersion> <FileVersion>$(AssemblyVersion)</FileVersion>
<Authors>iminet</Authors> <Authors>iminet</Authors>
@@ -23,6 +23,7 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<CheckEolTargetFramework>false</CheckEolTargetFramework> <CheckEolTargetFramework>false</CheckEolTargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="Readme.md" Pack="true" PackagePath="\"></None> <None Include="Readme.md" Pack="true" PackagePath="\"></None>
<None Include="Resources\imgbb.png" Pack="true" PackagePath="\"></None> <None Include="Resources\imgbb.png" Pack="true" PackagePath="\"></None>
+119 -1
View File
@@ -1,4 +1,122 @@
# ImgBBApi # ImgBBApi
A lightweight C# client library for uploading images to [ImgBB](https://imgbb.com/) from .NET applications.
`ImgBBApi` accepts either local image file paths or Base64-encoded image data and returns the direct URLs generated by ImgBB.
## Features
- Upload one or more local image files
- Upload Base64-encoded image content
- Async API built on `HttpClient`
- Multi-targets .NET 5, .NET 6, .NET 7, and .NET 8
## Installation
Install the package from NuGet:
```bash
dotnet add package Iminetsoft.ImgBBApi
```
Or use the NuGet Package Manager Console:
```powershell
Install-Package Iminetsoft.ImgBBApi
```
## Getting an ImgBB API key
1. Sign in to [ImgBB](https://imgbb.com/).
2. Create an API key from the [ImgBB API key page](https://api.imgbb.com/).
3. Keep the key private—do not commit it to source control.
For example, store it in an environment variable:
```bash
export IMGBB_API_KEY="your-api-key"
```
## How to use
### Upload local files
```csharp
using System;
using System.Collections.Generic;
using Iminetsoft;
var apiKey = Environment.GetEnvironmentVariable("IMGBB_API_KEY");
var client = new ImgBBApi(apiKey);
var imageUrls = await client.UploadImgbbAsync(new List<string>
{
@"C:\\images\\photo-1.png",
@"C:\\images\\photo-2.jpg"
});
foreach (var imageUrl in imageUrls)
{
Console.WriteLine(imageUrl);
}
```
### Upload Base64 image data
Pass a Base64-encoded image string instead of a file path:
```csharp
using System;
using System.Collections.Generic;
using System.IO;
using Iminetsoft;
var apiKey = Environment.GetEnvironmentVariable("IMGBB_API_KEY");
var client = new ImgBBApi(apiKey);
var base64Image = Convert.ToBase64String(
await File.ReadAllBytesAsync("photo.png"));
var imageUrls = await client.UploadImgbbAsync(new List<string>
{
base64Image
});
Console.WriteLine(imageUrls[0]);
```
## API reference
### `ImgBBApi(string apiKey)`
Creates a client with the ImgBB API key used for all upload requests.
### `Task<List<string>> UploadImgbbAsync(List<string> imagePaths)`
Uploads each supplied value to ImgBB and returns a list of image URLs.
Each item may be:
- a path to an existing local image file; or
- a Base64-encoded image string.
The returned list follows the successful upload order. If an upload fails, the current implementation suppresses the exception and may return an empty or partial list.
## Requirements
- .NET 5.0, 6.0, 7.0, or 8.0
- A valid ImgBB API key
- Internet access to `https://api.imgbb.com`
## Notes
- ImgBB controls its own upload limits, retention, and content policies. Consult the [ImgBB API documentation](https://api.imgbb.com/) for the current terms and limits.
- Treat API keys and uploaded image URLs according to your application's security and privacy requirements.
## Origin ## Origin
This project is based on [qalibqurbanov's project](https://github.com/qalibqurbanov/Imager)
This project is based on [qalibqurbanov/Imager](https://github.com/qalibqurbanov/Imager).
## License
No license is currently specified in this repository. Add a license file before distributing or reusing the project under explicit terms.