GithubHelp home page GithubHelp logo

imagebucket's Introduction

ImageBucket

ImageBucket is a proof of concept image hosting website. It doesn't use any 3rd party software.

View the live site!

Features

  • Account creation
  • Image upload & deletion
  • Thumbnail creation
  • Profile page
  • Individual image page

Single Page Application

Even when viewing profiles or individual images, the only page ever served is index.php. This is done by using htaccess rewrite rules to convert certain URLs into php GET statements. For example, vising img.zrmiller.com/u/testuser uses the rule

RewriteCond %{REQUEST_URI} ^/u/.+$
RewriteRule ^/?u/(.+)$ /index.php?profile=$1 [L]

to reinterpret the url as img.zrmiller.com/index.php?profile=testuser. This GET statement then triggers an include in index.php to add the contents of includes_img/page/profile.php, which handles displaying the images uploaded by the target user.

Image Uploading & Display

When images are uploaded, they have a thumbnail created automatially if the file type is supported (png, jpg, gif, webp). Uploaded files are stored outside of the root directory of the website, so they cannot be viewed directly.

To serve an image, metadata is fetched from the database, added to the reponse header, then the image file is output using php. This allows for features such as privacy settings (not implemented) or fallback images. For example, if you request a thumbnail of an image with no thumbnail, the full sized image will be served instead. If you request a nonexistant image, a generic image is served instead.

API

The website offers a simple REST API for reading data from the website. Documentation.

imagebucket's People

Contributors

zmilla93 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.