diff --git a/docker-compose.yml b/docker-compose.yml index cb58185..3d5b24d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,10 +11,10 @@ services: - UPLOAD_SECRETS=set me # You can add multiple secrets. Format: secret1,secret2,secret3 - UPLOAD_DIR=./ # The directory to store the uploaded files - USE_RANDOM_FILE_NAMES=true # If true, the uploaded files will be renamed to a random string + - FILE_NAME_LENGTH=8 # The length of the random file name - SHOULD_CONVERT_TO_WEBP=true # If true, the uploaded files will be converted to webp - WEBP_QUALITY=95 # The quality of the converted webp files - WEBP_THREADHOLD=1048576 # The minimum file size to convert to webp (1MB in bytes) - - FILE_NAME_LENGTH=8 # The length of the random file name ports: - 80:80 volumes: diff --git a/docker/start.sh b/docker/start.sh index 5ef1821..a3f2604 100644 --- a/docker/start.sh +++ b/docker/start.sh @@ -14,10 +14,10 @@ fi echo "env[DOCKER] = true" >> /etc/php/8.1/fpm/pool.d/www.conf echo "env[UPLOAD_DIR] = ${UPLOAD_DIR}" >> /etc/php/8.1/fpm/pool.d/www.conf echo "env[USE_RANDOM_FILE_NAMES] = ${USE_RANDOM_FILE_NAMES}" >> /etc/php/8.1/fpm/pool.d/www.conf +echo "env[FILE_NAME_LENGTH] = ${FILE_NAME_LENGTH}" >> /etc/php/8.1/fpm/pool.d/www.conf echo "env[SHOULD_CONVERT_TO_WEBP] = ${SHOULD_CONVERT_TO_WEBP}" >> /etc/php/8.1/fpm/pool.d/www.conf echo "env[WEBP_QUALITY] = ${WEBP_QUALITY}" >> /etc/php/8.1/fpm/pool.d/www.conf echo "env[WEBP_THREADHOLD] = ${WEBP_THREADHOLD}" >> /etc/php/8.1/fpm/pool.d/www.conf -echo "env[FILE_NAME_LENGTH] = ${FILE_NAME_LENGTH}" >> /etc/php/8.1/fpm/pool.d/www.conf echo "Setting permissions for upload script" chmod 777 /var/www/html/upload.php diff --git a/upload.php b/upload.php index ddd4519..22822fe 100644 --- a/upload.php +++ b/upload.php @@ -15,10 +15,10 @@ if (getenv('DOCKER')) { // If the script is running in a Docker container $uploadSecrets = explode(",", getenv('UPLOAD_SECRETS')); // The upload secrets $uploadDir = getenv('UPLOAD_DIR'); // The upload directory $useRandomFileNames = getenv('USE_RANDOM_FILE_NAMES'); // Use random file names instead of the original file name + $fileNameLength = getenv('FILE_NAME_LENGTH'); // The length of the random file name $shouldConvertToWebp = getenv('SHOULD_CONVERT_TO_WEBP'); // Should the script convert images to webp? $webpQuality = getenv('WEBP_QUALITY'); // The quality of the webp image (0-100) $webpThreadhold = getenv('WEBP_THREADHOLD'); // The minimum file size for converting to webp (in bytes) - $fileNameLength = getenv('FILE_NAME_LENGTH'); // The length of the random file name } else { /** * !!! @@ -28,10 +28,10 @@ if (getenv('DOCKER')) { // If the script is running in a Docker container $uploadSecrets = array("set me"); // The upload secrets $uploadDir = "./"; // The upload directory $useRandomFileNames = false; // Use random file names instead of the original file name + $fileNameLength = 8; // The length of the random file name $shouldConvertToWebp = true; // Should the script convert images to webp? $webpQuality = 95; // The quality of the webp image (0-100) $webpThreadhold = 1048576; // 1MB - The minimum file size for converting to webp (in bytes) - $fileNameLength = 8; // The length of the random file name } /**