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 a permalink and lets you copy it right away. 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 | Composer | jQuery | Twig | Imagecraft | KEYS.css by Michael Hüneburg
- PHP
- Enable modules:
ctype
,exif
,fileinfo
,gd
,iconv
,mbstring
,openssl
andphar
. - Increase the
upload_max_filesize
andpost_max_size
to10M
- Enable modules:
- Nginx: increase client_max_body_size to
10M
- HTTP Server or PHP-FPM must have write access to the
i
andlogs
.
- Install Composer and update its dependencies:
php composer.phar update
. - Disallow access to dot files, logs and other unnecessary files in the web server configuration.
- Edit config.php, replace
allowed_hosts
with your domain and adjust the settings to your needs. - Edit manifest.json and change
start_url
for PWA.
git clone https://github.com/c0m4r/up.git
cd up
wget https://getcomposer.org/download/2.7.9/composer.phar
echo "b6de5e65c199d80ba11897fbe1364e063e858d483f6a81a176c4d60f2b1d6347 composer.phar" | sha256sum -c || rm composer.phar
php composer.phar update
This setup is based on joseluisq/alpine-php-fpm
git clone https://github.com/c0m4r/up.git
cd up
wget https://getcomposer.org/download/2.7.9/composer.phar
echo "b6de5e65c199d80ba11897fbe1364e063e858d483f6a81a176c4d60f2b1d6347 composer.phar" | sha256sum -c || rm composer.phar
docker compose up -d
docker compose exec php-fpm /bin/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 $(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}')
As an additional security measure you might want to scan uploaded files for malware.
See: paranoya integration (experimental)
- Animated WebP is not supported at this point
MIT License
Copyright (c) 2023 c0m4r
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
If you found this software helpful, please consider making donation to a charity on my behalf. Thank you.