Upgraded to php8.2 🎉🎉🎉

This commit is contained in:
Chris
2023-09-14 10:42:35 +02:00
parent f000404d5a
commit d3d5d1c385
5 changed files with 46 additions and 47 deletions

View File

@@ -11,11 +11,11 @@
<div align="center"> <div align="center">
![](https://img.shields.io/badge/php-7.1%2B-brightgreen.svg) ![](https://img.shields.io/badge/php-8.2%2B-brightgreen.svg)
[![](https://img.shields.io/docker/pulls/hascheksolutions/pictshare?color=brightgreen)](https://hub.docker.com/r/hascheksolutions/pictshare) [![](https://img.shields.io/docker/pulls/hascheksolutions/pictshare?color=brightgreen)](https://hub.docker.com/r/hascheksolutions/pictshare)
[![](https://img.shields.io/docker/cloud/build/hascheksolutions/pictshare?color=brightgreen)](https://hub.docker.com/r/hascheksolutions/pictshare/builds) ![](https://github.com/hascheksolutions/pictshare/actions/workflows/build-docker.yml/badge.svg)]
[![Apache License](https://img.shields.io/badge/license-Apache-brightgreen.svg?style=flat)](https://github.com/HaschekSolutions/pictshare/blob/master/LICENSE) [![Apache License](https://img.shields.io/badge/license-Apache-brightgreen.svg?style=flat)](https://github.com/HaschekSolutions/pictshare/blob/master/LICENSE)
![HitCount](https://visitor-badge.glitch.me/badge?page_id=pictshare) [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Fhascheksolutions%2Fpictshare&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
[![](https://img.shields.io/github/stars/HaschekSolutions/pictshare.svg?label=Stars&style=social)](https://github.com/HaschekSolutions/pictshare) [![](https://img.shields.io/github/stars/HaschekSolutions/pictshare.svg?label=Stars&style=social)](https://github.com/HaschekSolutions/pictshare)
#### Host your own `images` `gifs` `mp4s` `text bins` and stay in control #### Host your own `images` `gifs` `mp4s` `text bins` and stay in control
@@ -29,10 +29,6 @@
<img src="https://www.pictshare.net/39928d8239.gif" alt="PictShare demo"> <img src="https://www.pictshare.net/39928d8239.gif" alt="PictShare demo">
</p> </p>
# [INFO] March '23
Since Docker Hub won't allow team Organizations anymore, we moved our images to GitHub Container Registry.
So if you want to use the latest version, please use the new image `ghcr.io/hascheksolutions/pictshare` instead of `hascheksolutions/pictshare`
Table of contents Table of contents
================= =================
* [Quick Start](#quickstart) * [Quick Start](#quickstart)
@@ -62,7 +58,7 @@ Then open http://localhost:8080 in your browser
- [Encryption of files in external storage](/rtfm/ENCRYPTION.md) - [Encryption of files in external storage](/rtfm/ENCRYPTION.md)
- Added text hosting (like pastebin) - Added text hosting (like pastebin)
- Added URL shortening - Added URL shortening
- Added WebP to images (and conversion from jpg,png to webp) - Added WebP to images (and automatic conversion from jpg, png to webp if the requesting browser supports it)
- Massive code rework. Actually we designed it from the ground up to be more modular and easier to debug - Massive code rework. Actually we designed it from the ground up to be more modular and easier to debug
# Features # Features
@@ -70,13 +66,13 @@ Then open http://localhost:8080 in your browser
- Selfhostable - Selfhostable
- [Simple upload API](/rtfm/API.md) - [Simple upload API](/rtfm/API.md)
- 100% file based - no database needed - 100% file based - no database needed
- [Scalable](/rtfm/SCALING.md) - [Scalable hosting](/rtfm/SCALING.md)
- Many [Filters](/rtfm/IMAGEFILTERS.md) for images - Many [Filters](/rtfm/IMAGEFILTERS.md) for images
- GIF to MP4 conversion - GIF to MP4 conversion
- JPG, PNG to WEBP conversion - JPG, PNG to WEBP conversion
- MP4 resizing - MP4 resizing
- PictShare removes all exif data so you can upload photos from your phone and all GPS tags and camera model info get wiped - PictShare removes all exif data so you can upload photos from your phone and all GPS tags and camera model info get wiped
- Change and resize your uploads just by editing the URL - Change and resize your images and videos just by editing the URL
- Duplicates don't take up space. If the exact same file is uploaded twice, the second upload will link to the first - Duplicates don't take up space. If the exact same file is uploaded twice, the second upload will link to the first
- Many [configuration options](/rtfm/CONFIG.md) - Many [configuration options](/rtfm/CONFIG.md)
- Full control over your data. Delete images with individual and global delete codes - Full control over your data. Delete images with individual and global delete codes

View File

@@ -38,8 +38,8 @@ class PlaceholderGenerator {
if($textwidth > imagesx($im) || $textheight > imagesy($im)) if($textwidth > imagesx($im) || $textheight > imagesy($im))
return $im; return $im;
$x = (imagesx($im) - $textwidth) / 2; $x = intval((imagesx($im) - $textwidth) / 2);
$y = (imagesy($im) - $textheight) / 2 + $textheight; $y = intval((imagesy($im) - $textheight) / 2 + $textheight);
imagettftext($im, $fontsize, 0, $x, $y, $textcolor, $font, $text); imagettftext($im, $fontsize, 0, $x, $y, $textcolor, $font, $text);
return $im; return $im;
@@ -63,7 +63,7 @@ class PlaceholderGenerator {
for($x=0;$x<=$w;$x++) { // loop columns for($x=0;$x<=$w;$x++) { // loop columns
for($y=0;$y<=$h;$y++) { // loop rows for($y=0;$y<=$h;$y++) { // loop rows
// set pixel color // set pixel color
$col=imagecolorallocate($im,$rgb[0],$rgb[1],$rgb[2]); $col=imagecolorallocate($im,intval($rgb[0]),intval($rgb[1]),intval($rgb[2]));
imagesetpixel($im,$x-1,$y-1,$col); imagesetpixel($im,$x-1,$y-1,$col);
// calculate new color // calculate new color
for($i=0;$i<=2;$i++) { for($i=0;$i<=2;$i++) {

View File

@@ -1,9 +1,8 @@
FROM alpine:3.14.2 FROM alpine:3.18
RUN apk add --no-cache bash socat wget curl nginx file ffmpeg unzip \ RUN apk add --no-cache bash socat wget curl nginx file ffmpeg unzip zlib \
php7-fileinfo \ php82-fileinfo \
php7-session \ php82-session \
zlib \
php \ php \
php-curl \ php-curl \
php-openssl \ php-openssl \
@@ -12,26 +11,27 @@ RUN apk add --no-cache bash socat wget curl nginx file ffmpeg unzip \
php-gd \ php-gd \
php-dom \ php-dom \
php-fpm \ php-fpm \
php7 \ php82 \
php7-pdo \ php82-pdo \
php7-exif \ php82-exif \
php7-mcrypt \ php82-curl \
php7-curl \ php82-gd \
php7-gd \ php82-json \
php7-json \ php82-phar \
php7-phar \ php82-fpm \
php7-fpm \ php82-openssl \
php7-openssl \ php82-ctype \
php7-ctype \ php82-opcache \
php7-opcache \ php82-mbstring \
php7-mbstring \ php82-sodium \
php7-sodium \ php82-xml \
php7-xml \ php82-ftp \
php7-ftp \ php82-simplexml \
php7-simplexml \ php82-session \
php7-session \ php82-fileinfo \
php7-fileinfo \ php82-pcntl
php7-pcntl
RUN ln -s /usr/bin/php82 /usr/bin/php
RUN curl -sS https://getcomposer.org/installer | /usr/bin/php -- --install-dir=/usr/bin --filename=composer RUN curl -sS https://getcomposer.org/installer | /usr/bin/php -- --install-dir=/usr/bin --filename=composer
RUN mkdir -p /var/www RUN mkdir -p /var/www
@@ -51,11 +51,11 @@ WORKDIR /var/www
ADD docker/rootfs/nginx.conf /etc/nginx/http.d/default.conf ADD docker/rootfs/nginx.conf /etc/nginx/http.d/default.conf
RUN mkdir -p /run/nginx RUN mkdir -p /run/nginx
RUN mkdir -p /var/log/nginx RUN mkdir -p /var/log/nginx
RUN sed -i 's/nobody/nginx/g' /etc/php7/php-fpm.d/www.conf RUN sed -i 's/nobody/nginx/g' /etc/php82/php-fpm.d/www.conf
# Since requests can trigger conversion, let's give the server enough time to respond # Since requests can trigger conversion, let's give the server enough time to respond
RUN sed -i "/max_execution_time/c\max_execution_time=3600" /etc/php7/php.ini RUN sed -i "/max_execution_time/c\max_execution_time=3600" /etc/php82/php.ini
RUN sed -i "/max_input_time/c\max_input_time=3600" /etc/php7/php.ini RUN sed -i "/max_input_time/c\max_input_time=3600" /etc/php82/php.ini
WORKDIR /var/www/ WORKDIR /var/www/

View File

@@ -5,15 +5,18 @@
_maxUploadSize() { _maxUploadSize() {
echo "[i] Setting uploadsize to ${MAX_UPLOAD_SIZE}M" echo "[i] Setting uploadsize to ${MAX_UPLOAD_SIZE}M"
sed -i "/post_max_size/c\post_max_size=${MAX_UPLOAD_SIZE}M" /etc/php7/php.ini sed -i "/post_max_size/c\post_max_size=${MAX_UPLOAD_SIZE}M" /etc/php82/php.ini
sed -i "/upload_max_filesize/c\upload_max_filesize=${MAX_UPLOAD_SIZE}M" /etc/php7/php.ini sed -i "/upload_max_filesize/c\upload_max_filesize=${MAX_UPLOAD_SIZE}M" /etc/php82/php.ini
# set error reporting no notices, no warnings
sed -i "/^error_reporting/c\error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING & ~E_NOTICE" /etc/php82/php.ini
sed -i -e "s/50M/${MAX_UPLOAD_SIZE}M/g" /etc/nginx/http.d/default.conf sed -i -e "s/50M/${MAX_UPLOAD_SIZE}M/g" /etc/nginx/http.d/default.conf
MAX_RAM=$((MAX_UPLOAD_SIZE + 30)) # 30megs more than the upload size MAX_RAM=$((MAX_UPLOAD_SIZE + 30)) # 30megs more than the upload size
echo "[i] Also changing memory limit of PHP to ${MAX_RAM}M" echo "[i] Also changing memory limit of PHP to ${MAX_RAM}M"
sed -i -e "s/128M/${MAX_RAM}M/g" /etc/php7/php.ini sed -i -e "s/128M/${MAX_RAM}M/g" /etc/php82/php.ini
sed -i "/memory_limit/c\memory_limit=${MAX_RAM}M" /etc/php7/php.ini sed -i "/memory_limit/c\memory_limit=${MAX_RAM}M" /etc/php82/php.ini
} }
_filePermissions() { _filePermissions() {
@@ -74,7 +77,7 @@ if [[ ${SKIP_FILEPERMISSIONS:=false} != true ]]; then
fi fi
echo ' [+] Starting php' echo ' [+] Starting php'
php-fpm7 php-fpm82
echo ' [+] Creating config' echo ' [+] Creating config'

View File

@@ -4,7 +4,7 @@ spl_autoload_register('autoload');
//disable output buffering //disable output buffering
if (ob_get_level()) ob_end_clean(); if (ob_get_level()) ob_end_clean();
error_reporting(E_ALL & ~E_NOTICE); error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
if(!defined('FFMPEG_BINARY')) if(!defined('FFMPEG_BINARY'))
define('FFMPEG_BINARY',ROOT.DS.'bin'.DS.'ffmpeg'); define('FFMPEG_BINARY',ROOT.DS.'bin'.DS.'ffmpeg');