
ImgLink for Generic API Adapter
The ImgLink Generic API Adapter is a standalone PHP 8 file designed to integrate image hosting into any platform that can run PHP. It exposes imglink_upload_generic() with a retry loop, structured array response, and graceful failure mode — returning ['ok' => false, 'error' => '...'] instead of throwing exceptions, making it safe to use in legacy codebases. Returns url, thumbnail, width, height, size, and mime type on success. Works in WordPress, Drupal, custom PHP apps, and any framework.
Requirements
- PHP 8.0 or higher
- cURL PHP extension
- ImgLink API key (free)
- Any CMS, framework, or custom PHP app
WordPress sites, Drupal installations, custom PHP applications
What's included
Installation Guide
Follow these steps to integrate ImgLink with Generic API Adapter.
Include adapter.php
Drop adapter.php anywhere in your project and require it.
require_once '/path/to/adapter.php';
Generate an API key
Create a key in ImgLink Settings → API Keys. Optionally restrict it to your domain.
Call the adapter
Pass your temp file path and a config array to imglink_upload_generic().
$config = [
'apiBase' => 'https://imglink.cc',
'apiKey' => 'YOUR_KEY_HERE',
'retries' => 3,
'timeout' => 30,
];
$result = imglink_upload_generic('/tmp/upload.jpg', $config);Handle the response
Check result['ok'] before using the URL. On failure, result['error'] contains the reason.
if ($result['ok']) {
echo $result['url']; // CDN URL
} else {
error_log($result['error']);
}Why host images on ImgLink?
Global CDN
Images served from a global edge network. Sub-100ms load times. No bandwidth cost to your forum server.
Scoped API Keys
One API key per forum. Revoke or rotate instantly. Keys never leave your config file — never hardcoded.
Retry Safety
Exponential backoff on every upload. Images never fail silently — retries handle transient network issues.
Ready to deploy ImgLink on Generic API Adapter?
Download the plugin, add your API key, and go live in under 10 minutes. Free to use — no credit card required.



