Skip to content

Commit

Permalink
Upgraded to php8.2 🎉🎉🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
geek-at committed Sep 14, 2023
1 parent f000404 commit d3d5d1c
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 47 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
<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/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)
![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)

#### Host your own `images` `gifs` `mp4s` `text bins` and stay in control
Expand All @@ -29,10 +29,6 @@
<img src="https://www.pictshare.net/39928d8239.gif" alt="PictShare demo">
</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
=================
* [Quick Start](#quickstart)
Expand Down Expand Up @@ -62,21 +58,21 @@ Then open http://localhost:8080 in your browser
- [Encryption of files in external storage](/rtfm/ENCRYPTION.md)
- Added text hosting (like pastebin)
- 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

# Features

- Selfhostable
- [Simple upload API](/rtfm/API.md)
- 100% file based - no database needed
- [Scalable](/rtfm/SCALING.md)
- [Scalable hosting](/rtfm/SCALING.md)
- Many [Filters](/rtfm/IMAGEFILTERS.md) for images
- GIF to MP4 conversion
- JPG, PNG to WEBP conversion
- 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
- 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
- Many [configuration options](/rtfm/CONFIG.md)
- Full control over your data. Delete images with individual and global delete codes
Expand Down
6 changes: 3 additions & 3 deletions content-controllers/placeholder/placeholdergenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ function addSizeText($im,$modifiers)
if($textwidth > imagesx($im) || $textheight > imagesy($im))
return $im;

$x = (imagesx($im) - $textwidth) / 2;
$y = (imagesy($im) - $textheight) / 2 + $textheight;
$x = intval((imagesx($im) - $textwidth) / 2);
$y = intval((imagesy($im) - $textheight) / 2 + $textheight);
imagettftext($im, $fontsize, 0, $x, $y, $textcolor, $font, $text);

return $im;
Expand All @@ -63,7 +63,7 @@ function gradient($im, $c) {
for($x=0;$x<=$w;$x++) { // loop columns
for($y=0;$y<=$h;$y++) { // loop rows
// 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);
// calculate new color
for($i=0;$i<=2;$i++) {
Expand Down
56 changes: 28 additions & 28 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
php7-fileinfo \
php7-session \
zlib \
RUN apk add --no-cache bash socat wget curl nginx file ffmpeg unzip zlib \
php82-fileinfo \
php82-session \
php \
php-curl \
php-openssl \
Expand All @@ -12,26 +11,27 @@ RUN apk add --no-cache bash socat wget curl nginx file ffmpeg unzip \
php-gd \
php-dom \
php-fpm \
php7 \
php7-pdo \
php7-exif \
php7-mcrypt \
php7-curl \
php7-gd \
php7-json \
php7-phar \
php7-fpm \
php7-openssl \
php7-ctype \
php7-opcache \
php7-mbstring \
php7-sodium \
php7-xml \
php7-ftp \
php7-simplexml \
php7-session \
php7-fileinfo \
php7-pcntl
php82 \
php82-pdo \
php82-exif \
php82-curl \
php82-gd \
php82-json \
php82-phar \
php82-fpm \
php82-openssl \
php82-ctype \
php82-opcache \
php82-mbstring \
php82-sodium \
php82-xml \
php82-ftp \
php82-simplexml \
php82-session \
php82-fileinfo \
php82-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 mkdir -p /var/www
Expand All @@ -51,11 +51,11 @@ WORKDIR /var/www
ADD docker/rootfs/nginx.conf /etc/nginx/http.d/default.conf
RUN mkdir -p /run/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
RUN sed -i "/max_execution_time/c\max_execution_time=3600" /etc/php7/php.ini
RUN sed -i "/max_input_time/c\max_input_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/php82/php.ini

WORKDIR /var/www/

Expand Down
13 changes: 8 additions & 5 deletions docker/rootfs/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@
_maxUploadSize() {
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 "/upload_max_filesize/c\upload_max_filesize=${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/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

MAX_RAM=$((MAX_UPLOAD_SIZE + 30)) # 30megs more than the upload size
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 "/memory_limit/c\memory_limit=${MAX_RAM}M" /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/php82/php.ini
}

_filePermissions() {
Expand Down Expand Up @@ -74,7 +77,7 @@ if [[ ${SKIP_FILEPERMISSIONS:=false} != true ]]; then
fi

echo ' [+] Starting php'
php-fpm7
php-fpm82

echo ' [+] Creating config'

Expand Down
2 changes: 1 addition & 1 deletion inc/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//disable output buffering
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'))
define('FFMPEG_BINARY',ROOT.DS.'bin'.DS.'ffmpeg');
Expand Down

0 comments on commit d3d5d1c

Please sign in to comment.