Warning: include(/home2/darkie2/public_html/include/common.php) [function.include]: failed to open stream: No such file or directory in /home/anigaiku/public_html/serve/api.php on line 5

Warning: include() [function.include]: Failed opening '/home2/darkie2/public_html/include/common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/anigaiku/php') in /home/anigaiku/public_html/serve/api.php on line 5
ANIGAIKU - ASIS

Asis Documentation

This is the documentation for the AG ASIS now available to public use.

Table of contents

  1. Overview
    1. Why use it?
  2. API
    1. HTTP
      1. Method
      2. Url
    2. Parsing
      1. Series
        1. Example
      2. Methods
        1. PHP
          1. Function
    3. Sizing
    4. Error Responses
top

Overview

Asis, an anagram that stands for Anime Series Image Servlet, is a servlet that uses shows images based on requests.

Why? What use is that?

Asis allows programmers, designers, webmasters.. ect to have an easily obtainable resource of thumbnailed to full sized images for popular, and common series. Allowing you to utilise more space on your server for your other needs or wants. Also, saving you time from having to create images, or making that extra panel on your site for users to add images. It's already done, and its Asis.
top

Asis Api

top

HTTP

Method
GET

Url
http://serve.anigaiku.com/size/series
top

Parsing

top

Series

  • Series name to lowercase
  • Replace all characters except spaces, alphanumericals
  • Replace multiple spaces if needed.
  • Trim ending spaces
  • Replace spaces with underscores
Example
http://serve.anigaiku.com/34/soul_eater view?
If the series does not exist you will receive the 903 error code.

top

Methods

top

PHP

	// Series
	$series = strtolower($_POST['series']);
	$series = preg_replace('/[^a-z0-9\ ]/', '', $series);
	$series = preg_replace("/(\s)+/", " ", $series);
	$series = trim($series);
	$series = str_replace(' ', '_', $series);
Shown above is a simple way to parse a normal series title like: Soul Eater into soul_eater fully compatable with asis.

Function
	function asis($size, $series, $square = false) {
		$series = strtolower($series);
		$series = preg_replace('/[^a-z0-9\ ]/', '', $series);
		$series = preg_replace("/(\s)+/", " ", $series);
		$series = trim($series);
		$series = str_replace(' ', '_', $series);
		
		// Squaring
		if($square)
		{
			$size = $size.'s';
		}
		
		return 'http://serve.anigaiku.com/'.$size.'/'.$series;
	}
The function above takes the php method and asks for what size, and if you want to square it. Not to be used with user submitted variables. Example of use:
	<?php echo asis('34', 'Soul Eater'); ?>
Using just the function would output a url like so: http://serve.anigaiku.com/34/soul_eater

Example of creating image with asis function:
	<img src="<?php echo asis('34', 'Soul Eater'); ?>" alt="Soul Eater Image" />
top

Sizing

Images can be served 9 different ways through the api, all of them allowing for multiple uses.
  • 34 - ratio parsed 34 x *, smallest size
  • 34s - square cube 34 x 34, smallest size
  • 64 - ratio parsed 64 x *, thumbnail size
  • 64s - square cube 64 x 64, thumbnail size
  • 126 - ratio parsed 126 x *, medium size
  • 126s - square cube 126 x 126, medium size
  • 252 - ratio parsed 252 x *, large size
  • 500 - ratio parsed 500 x *, mega size
  • 000 - ???, default image
If an incorrect size is entered you will recieve the 904 error.
top

Error Responses

	902	- Series contains invalid characters
	903	- Invalid series
	904	- Invalid image size
	905	- Open for future use
	906	- Rate limit reached for x size
	907	- Rate limit abuse reached