Tiny File Hoster


Minimal PHP Script to host a simple Image Hosting, like http://www.imageshack.us.

Some demo:



Version: 1.1 (04/04/2009)
Download: Link (HTTP)
License: LGPL
Requisites: PHP5, GD Library
Author: Clodo (Contact me with a PM in Osiris Forum)

Frequenty Asked Questions

How to install?
Download and extract the zip file.
Upload to your server.
Ensure that directory "/images", "/temp" and "/thumbs" are writable.
Edit "conf.php" and set your preferences; red items are mandatory.
$baseUrl Base url of installation.
$homeUrl Same as $baseUrl. It's the logo link.
$title Title
$subtitle Subtitle. Specify here if is a private file hosting.
$maxSize

Maximum allowed size, in bytes, of uploaded file.

Default: "2000000"

$thumbWidth

Width, in pixel, of generated thumbnail.

Default: "200"

$imagesPath

Path of images directory. Must be writable.

Default: "images/"

$thumbsPath

Path of thumbnail directory. Must be writable.

Default: "thumbs/"

$tempPath

Path of temporary directory. Must be writable.

Default: "temp/"

$listAllowed

If true, anyone can view the hosted files with
http://www.mydomain.ex/host/?act=lists (Full List)
or
http://www.mydomain.ex/host/?act=thumbs (Thumbnails List).

Default: "true"

$thumbsCols

If List are enabled, specify the number of columns in Thumbnails List.

Default: "7"

$password

If specified, a password is required to upload files. Can be useful for private repository.

Default: none

$logo

The path of the logo image.

Default: "logo.png"

How to avoid bandwidth stolen?
You can create a file, called ".htaccess" , and put it in "images/" and "thumbs/" directory. Will work only with Apache.
Example:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.ex/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.frienddomain.ex/.*$ [NC]
RewriteCond %{REQUEST_URI} !^/stolen.png [NC]
RewriteRule \.(gif|GIF|jpg|JPG)$ http://www.mydomain.ex/host/stolen.png [R]
  
The example above will redirect any image request to an image "http://www.mydomain.ex/host/stolen.gif" if the request don't come from domains www.mydomain.ex or www.frienddomain.ex.
How i can customize the layout?
You can change the logo image, or specify other CSS styles with file "skin.css".
This stuff is licensed under a Creative Commons Attribution-ShareAlike 2.0 License.

This tool is provided without warranty, guarantee, or much in the way of explanation. Note that use of this tool may or may not crash your browser, lock up your machine, erase your hard drive, or e-mail those naughty pictures you hid in the Utilities folder to your mother. Don't blame me if anything bad happens to you, because it's actually the aliens' fault. The code expressed herein is solely that of the author, and he's none too swift with the JavaScript, if you know what we mean, so it's likely to cause giggle fits in anyone who knows what they're doing. Not a flying toy. Thank you for playing. Insert coin to continue.