Introduction
The cursed-img api is written in php, counting how many *.png
files are within a specified directory.
API File Structure
Root Dir of API: /api/cursed-img
Images Directory: /api/cursed-img/images
Usage
The api generates a random number from 0 to the number of .png files present within the previously specified directory. It will then generate a URL heading to the image e.g. image 8.png would generate the url https://phemius.net/api/cursed-img/images/8.png .
This is then sent in a JSON format enabling most languages to use the data produced.
Example output of the API
{"image_url":"https://phemius.net/api/cursed-img/images/3.png"}
The client-side or whatever code had send the request to the api will be sent the RAW JSON data (similar to the above example). This can therefore be used to produce an image output for the client.
Example Code
Lets say, you want your viewers to be able to see a cursed image every time they reload your website. You can use a range of methods to complete this, however we will use php.