*** ImageStorage ***

(c) 2021-2022 CsAB :: v1.1ß (build: 2022-03-27) ==============================================================================

1. Introducing

This document describes all the available API calls for ImageStorage when creating, updating, finding and converting images. For documentation on serving raw and transformed images once uploaded into your ImageStorage hosted storage.

2. Base URL

https://is.webhirdet.hu/ This is the base URL used for all API requests described in this document. It consists of: Scheme: https Host: im.webhirdet.hu

3. Authentication

You may choose any of the following methods to authenticate with the ImageStorage:

3.1. Query string

Set the key query parameter in your API requests: ?api_key=YOUR_API_KEY&... This is the default authentication method.

3.2. Account

Account and YOUR_API_KEY created by System Adminitrators (in XML format): The YOUR_API_KEY length 32 alphanumeric characters. Example: <settings> <key>01234567890abcdefghijklmnopqrstu</key> <user>google.com</user> <ip_filter> // used only this IPs <ip>64.233.160.0</ip> <ip>66.102.0.0</ip> <ip>209.85.128.0</ip> </ip_filter> <drop_source>yes</drop_source> // yes: remove original source (after conversion) <types> <type>webp</type> <type>gif</type> <type>jpg</type> <type>png</type> <type>avif</type> </types> <sizes> <size>500x500</size> <size>32x32</size> <size>128x128</size> <size>640x480</size> <size>1200x900</size> <size>0x500</size> <size>500x0</size> </sizes> <fits> <fit>clip</fit> <fit>crop</fit> <fit>scale</fit> <fit>max</fit> </fits> </settings>

4. Images

The following section describes how to create, update, search and convert images in your ImageStorage account.

4.1. Create (from URL)

Saves an image into your ImageStorage online hosted storage using a source image which is publicly accessible via an HTTP or HTTPS URL. +-------------------------------------------------------------------+ | WARNING! In some cases, you can use only the parameters that were | | previously enabled in your ACCOUNT XML file. | +-------------------------------------------------------------------+

4.1.1. Query String Parameters

============================================================================== Parameter :: Type :: Required :: Description ============================================================================== api_key :: string :: true :: Your API key url :: string :: true :: Publicly accessible URL of the source image you would like to copy to your local storage. (Note: Use URL encoding!) fit :: string :: true :: The fit parameter controls how the (from output image is fit to its target XML) dimensions after resizing, and how any background areas will be filled. Valid values are: clip, crop, max and scale. NO default value! size :: string :: :: The width and height of the output (from image. Primary mode is a positive XML) integer, interpreted as pixel width and height. Examples: size=640x480, size=480x640, size=0x640, size=480x0 and size=480x480 or size=640x640 Max. width and height is 2000 pixels. Min. width and height is 1 pixel, however in scale fit available 0 pixel. format :: string :: true :: The output format to convert the (from image to.Valid values are: XML) jpg, jpeg, png, gif, webp and avif nocache :: string :: false :: The output image load from forced converted from original source. Not loading from cache (if exists). redirect :: string :: false :: Not show output json information. Will be redirect to response url (image). ==============================================================================

4.1.2. Resize Fit Modes

The fit parameter controls how the output image is fit to its target dimensions after resizing, and how any background areas will be filled. fit=clip Resizes the image to fit within the width and height boundaries without cropping or distorting the image. The resulting image will match one of the constraining dimensions, while the other dimension is altered to maintain the same aspect ratio of the input image. Example: Original images is 300x200 pixels. fit=clip&size=100x100: Attempting to resize this image to be 100x100 with a fit mode of clip will result in an image that is 100x67 because the aspect ratio of the original image is maintained. Examples: * fit=clip&size=640x480 * fit=clip&size=0x600 !!! 0 only fits=scale !!! * fit=clip&size=600x0 !!! 0 only fits=scale !!! * fit=clip&size=80x80 fit=crop Resizes the image to fill the width and height dimensions and crops any excess image data. The resulting image will match the width and height constraints without distorting the image. It's used in conjunction with the the crop parameter, which controls how the image is cropped. Both the w and h parameters will also need to be set. Example: Original images is 300x200 pixels. fit=crop&size=300x100: Resizing the image to 300x100 with fit=crop will fit the image exactly to those dimensions. fit=crop&size=200x200: Setting an equal value for width and height along with fit=crop will always result in a square image. Examples: * fit=crop&size=640x480 * fit=crop&size=0x600 !!! 0 only fits=scale !!! * fit=crop&size=600x0 !!! 0 only fits=scale !!! * fit=crop&size=80x80 !!! The "FIT=MAX" is not yet implemented !!! fit=max Resizes the image to fit within the width and height dimensions without cropping or distorting the image, but will not increase the size of the image if it is smaller than the output size. The resulting image will maintain the same aspect ratio of the input image. Example: Original images is 300x200 pixels. fit=max&size=500x300: Attempting to resize to 500x300 will result in an image that is 300x200, the original dimensions of the image, applying max will not scale up the image. fit=max&size=200x400: Attempting to resize to 200x400 will result in a 200x133 image. This behavior is somewhat similar to clip. Examples: * fit=max&size=640x480 * fit=max&size=0x600 !!! 0 only fits=scale !!! * fit=max&size=600x0 !!! 0 only fits=scale !!! * fit=max&size=80x80 fit=scale Scales the image to fit the constraining dimensions exactly. The resulting image will fill the dimensions, and will not maintain the aspect ratio of the input image. Examples: * fit=scale&size=640x480 * fit=scale&size=0x600 (resize and keep aspect ratio) * fit=scale&size=600x0 (resize and keep aspect ratio) * fit=scale&size=80x80

4.1.3. Sample / Demo

Original image: https://i.ibb.co/9thX75y/rubber-duck-320x200.png Yellow rubber duck. This image is in the public domain. Yellow rubber duck (This image is in the public domain.)

CONVERT (from URL) and STORAGE: FIT=clip, SIZE=80x80 and FORMAT=jpg USE: https://is.webhirdet.hu/im.php?url={url}&api_key={api_key}&fit={fit} &size={width}x{height}&format={format} DEMO: https://i.ibb.co/9thX75y/rubber-duck-320x200.png &api_key=YOUR_API_KEY&fit=clip&size=80x80&format=jpg JSON RESPONSE: { "version":"CsAB ImageStorage v1.1\u00df (build: 2022-03-27)", "success":true, "error":false, "response":{ "API_KEY":"{api_key}", "user":"{username}", "available_types":[ "jpg" ], "available_sizes":[ "80x80", "320x200", "128x128" ], "available_fits":[ "clip", "crop", "scale" ], "remote_address":"64.233.160.0", "referrer":false, "request_url":"https:\/\/i.ibb.co\/9thX75y\/rubber-duck-320x200.png", "request_format":"jpg", "request_size":"80x80", "request_fit":"clip", "original_size":39752, "load_from_cache":false, "created":1648319658, "created_human":"Sat, 26 Mar 2022 19:34:18 +0100", "type":"webp", "mime":"image\/jpeg", "size":1502, "percent":3.78, "width":80, "height":80, "fit":"clip", "path":"store\/775ab3530dd252bf020c65eadc8f19d8\/1458d01f\/bb22f009\/5cd73b77\/", "filename":"c14da88a_clip-900x900", "extension":"jpg", "url":"https:\/\/is.webhirdet.hu\/store\/ 775ab3530dd252bf020c65eadc8f19d8\/1458d01f\/178910c3\/5cd73b77\/c7c6012b_clip-80x80.jpg" } } RESPONSE URL: /store/775ab3530dd252bf020c65eadc8f19d8/1458d01f/178910c3/ 5cd73b77/c7c6012b_clip-80x80.jpg

5. Error and errormessages

5.1. JSON Errors

with an errormessage and empty response: { "version":"CsAB ImageStorage v1.1\u00df", "success":false, "error":"ERROR #001: Invalid or missing API KEY", "response":[] }

5.2. Error Code on Image

for image process errors (ERROR #001: Invalid or missing API KEY): Error #001: Invalid or missing API KEY

5.3. Missing Image

if an image not found or missing: Error 404 :: Image not found

5.4. ERROR 404 Message

if a page not found: Pfff! Error404 :: Image Storage

5.5. ERROR CODES

during image processing: * ERROR #001: Invalid or missing API KEY * ERROR #002: Wrong API KEY ... COMING SOON #EOF#