spiritualized / imgmagnet

A lightweight image host capable of serving images, including .webm dynamically using lighttpd's mod_magnet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

imgmagnet

imgmagnet is a lightweight image host designed for lighttpd. It allows images to be served dynamically using lighttpd's mod_magnet module.

Features

Supports bmp, gif, jpeg, png psd, webm.

Currently configured to record view counts in a MySQL database, though modification for other tasks, such as per-user watermarking, should be straightforward.

Setup

The script assumes it will be located in /imghost/. Track.lua will need some reconfiguration if it is placed elsewhere.

Import the schema into a MySQL database. Edit config.php and fill in the required details. Edit track.lua and also specify the MySQL configuration.

cd /imghost/www and composer install in order to add ffmpeg support to PHP, required for .webm files

Edit your lighttpd configuration to include a config block similar to below:

$HTTP["host"] == "imghost.domain.com" {

    	$HTTP["url"] =~ ".jpeg" {
    	        magnet.attract-physical-path-to = ("/imghost/track.lua")
    	}
    	$HTTP["url"] =~ ".jpg" {
    	        magnet.attract-physical-path-to = ("/imghost/track.lua")
    	}
    	$HTTP["url"] =~ ".png" {
            	magnet.attract-physical-path-to = ("/imghost/track.lua")
    	}
    	$HTTP["url"] =~ ".gif" {
    	        magnet.attract-physical-path-to = ("/imghost/track.lua")
    	}
    	$HTTP["url"] =~ ".webm" {
    	        magnet.attract-physical-path-to = ("/imghost/track.lua")
    	}
}

Ensure mod_magnet is enabled in the lighttpd config, and reload the server.

License

Released under GNU GPLv3.

About

A lightweight image host capable of serving images, including .webm dynamically using lighttpd's mod_magnet

License:GNU General Public License v3.0


Languages

Language:PHP 78.0%Language:Lua 22.0%