Skip to content

simple-works/random-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฒ Random Image

Web PHP

Web API that responds with a random image.

๐ŸŒ View Live

Screenshot

๐Ÿ“‚ Endpoints

๐Ÿ“ Directory Endpoint

GET random image from Local Directory (./dir/images).

  • ๐ŸŒ ./dir : returns Image File.
  • ๐ŸŒ ./dir?json : returns JSON File with this data:
    • title : friendly image title (ex: "Wracurd")
    • name : image file name with extension (ex: "wracurd_paint_p_ft.jpg").
    • type : image file mime type (example: "image/jpeg").
    • url : image file full url (example: "https://random-image.com/dir/images/wracurd_paint_p_ft.jpg").

๐Ÿ“ RSS Endpoint

GET random image from RSS Feed.

  • ๐ŸŒ ./rss : returns Image File.

JSON Generation

The JSON file data is fully based on the image file.

  • title is extracted from the image file name following this method:
    • If the name contains an underscore _, only the part that preceeds the underscore _ is taken. Else, the full name is taken.
    • The hyphens - in the name are replaced with spaces.
    • The first word is capitalized.
  • title extraction example:
    • quest in-the-City_paint_p_ft
    • โ†’ quest in-the-City
    • โ†’ quest in the City
    • โ†’ Quest in the City

๐Ÿš€ Development

๐Ÿญ Environment

๐ŸŒ‘ Backend

  • โš›๏ธ Core: PHP

๐Ÿ“„ License

Contributors

Languages