NewProfiles are here!View user profiles guide
Generic API Adapter
PHPUniversal

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.

Platform
Any PHP platform
Runtime
PHP 8.0+
Dependencies
Zero
CI Status
Passing

Requirements

  • PHP 8.0 or higher
  • cURL PHP extension
  • ImgLink API key (free)
  • Any CMS, framework, or custom PHP app
Used by

WordPress sites, Drupal installations, custom PHP applications

Download ZIP

What's included

Framework-agnostic, single-file drop-in
imglink_upload_generic() single-function API
Full retry loop with exponential backoff
Graceful failure — returns ok:false instead of throwing
X-API-Key authentication
Returns url, thumbnail, width, height, size, mime
Works in WordPress, Drupal, Laravel, custom apps
PHP 8.3 CI tested

Installation Guide

Follow these steps to integrate ImgLink with Generic API Adapter.

01

Include adapter.php

Drop adapter.php anywhere in your project and require it.

require_once '/path/to/adapter.php';
02

Generate an API key

Create a key in ImgLink Settings → API Keys. Optionally restrict it to your domain.

03

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);
04

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.