An image uploader. Written in PHP, supports popular formats: png, jpeg, gif, webp.
Lets you upload multiple images in a row and see them all in one view. Generates embed codes and a permalink. No bullshit steps along the way.
Uploaded image is verified and re-created from its contents to provide some layer of security against exploits.
- PHP: Enable modules:
ctype
,gd
,iconv
,mbstring
,openssl
andphar
. - Install Composer and update its dependencies:
php composer.phar update
- HTTP Server or PHP-FPM must have write access to the
i
andlogs
. - Nginx: change client_max_body_size
client_max_body_size 10M;
- PHP: Increase the
upload_max_filesize
andpost_max_size
:
upload_max_filesize = 10M
post_max_size = 10M
- Disallow access to dot files, logs and other unnecessary files in the web server configuration.
# example for nginx
# Deny access to dot files by default
location ~ /\. {
log_not_found off;
deny all;
}
location ~ (composer|docker-compose|logs|CHANGELOG|LICENSE) {
log_not_found off;
deny all;
}
- Edit config.php and adjust the settings to your needs.
Check docker-composer.yml
and .docker/nginx
configs and adjust to your needs.
This setup is based on joseluisq/alpine-php-fpm
git clone https://github.com/c0m4r/up.git
cd up
#mv .docker/docker-compose.ipv6.yml docker-compose.yml # for IPv6-only
docker compose up -d
docker compose exec server sh -c "cd /usr/share/nginx/html && curl -o composer.phar https://getcomposer.org/download/latest-stable/composer.phar"
docker compose exec php-fpm sh -c "cd /usr/share/nginx/html && php composer.phar update"
chown -R 82:82 i logs
Change uid:gid depending on your setup so the PHP-FPM have write access to the i
and logs
.
echo chown -R $(curl http://localhost:8080 &> /dev/null && ps -eo pid,uid,gid,command,cgroup | grep docke[r] | grep "php-fpm: pool www" | awk '{print $2":"$3}') i logs
By default the web server (nginx) listens on 8080.
- This code was not intended for public use, I did it for myself so if you want to use it you better know what you're doing as securing and fixing it is on your side
- Animated WebP is not supported at this point