download:
https://github.com/chrismccoy/funnyapi
Brief description
Quote:
FunnyAPI is a private invite only image API for WordPress.
I decided to develop a backend for various types of images, mostly humor related to be fetched from the WordPress post screen.
I know I could have simply just uploaded images to each WordPress install, but that would give me a migraine, and I thought it would be easier to have one central database that can be parsed via a Plugin.
|
Some screenshots:
Installation is pretty straight forward.
Quote:
Easy 5 Step install
1. Upload files to your domain root.
2. chmod the pictures and thumbs directory to be writable
3. Create a mysql database to use and import db.sql into the database
4. Edit config.inc.php in the includes/ directory with your domain, and mysql info.
5. Visit yourdomain.com/admin and login with admin/admin
|
Also you can parse the api outside of WordPress if you need to use it for a 3rd party app.
an example is in the /api directory called apitest.php
Code:
<?php
define("API_URL", "http://www.funnyapi.com/api/search.php?searchby=%s&q=%s&apikey=%s&max_results=%d&thumbsize=%s");
define('API_KEY', '198fe85619b5bb38758b2fcbe1b67cdc1600f63a');
function api_search($q, $by = 'all', $max_results = 16, $thumbsize = '200x200') {
$api_url = sprintf(API_URL, $by, $q, API_KEY, $max_results, $thumbsize);
$ch = curl_init($api_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close($ch);
if (stristr(strtolower($json), 'access denied') || stristr(strtolower($json), 'error')) {
return false;
} else {
if (($arr = json_decode($json)) !== FALSE) {
return $arr;
} else {
return false;
}
}
}
//$q = (isset($_GET['q']) ? $_GET['q'] : 'unassoc');
$q = $_GET['q'];
if(!$q) die('Missing Parameters!');
$results = api_search($q);
if (is_array($results)) {
foreach ($results as $idx => $obj) {
echo '<div style="float: left; margin-left: 5px;"><a href="' . $obj->full_url . '" target="_BLANK" title="' . $obj->title . '"><img alt="' . $obj->description . '" src="' . $obj->full_url . '" /></a><p><strong>Tags:</strong> ' . implode(',', $obj->tags) . '</p>';
}
} else {
echo 'API Request Failed';
}
?>
If anyone needs any help installing or getting running, let me know, you can also use this for say amateur pics if you have a lot of amateur blogs and you want a central location.

