A Home for My Photos
Table of Contents
Table of Contents
A Home for My Photos
Image-upload sites in China can rarely guarantee that they'll preserve the original. They always seem to compress uploads into something you can't make out even with glasses on.
I can't stand watching my birds and sunsets turn into mush every time I upload them..
So I'd really like to tinker with a home for my own photography. Let's record the tinkering, one complaint at a time.
Deployment
I looked at the private photo galleries people commonly use and found that Lychee's interface really suited my taste. Deploying with Docker was simple. For the sake of keeping it around, though, I put it on the new VPS. (I also discovered that Nginx Proxy Manager can proxy ports on other machines' IPs. I like it even more now.)
But then I discovered how badly some of Lychee's code was written... Time for a few more complaints...
Getting Started
The installer gave me a rough welcome straight away. The database I'd configured in docker-compose wasn't passed through. I had to create it manually and bind the username and password.
With help from G-laoshi (G 老师), that was easy enough. I also changed APP_URL to bind the domain directly, and set APP_FORCE_HTTPS to true. But once I got in, all the account, password, and domain settings needed changing again. I had to go into the Docker container and run nano .env... What was the initial setup screen even for, then...
Settings
The first thing I did was try to change the interface language to ZH_CN. I quickly found language under Basic. But changing en to ZH_CN did nothing.... I asked G-laoshi again. The solution was to change APP_LOCALE in .env.... I don't understand how this strange bug happens.
Later, I discovered I could find it directly in All Settings and change it there. Clicking it brought up a Save prompt, and then it worked...
Apparently, this was reported in an issue a long time ago. Why is it still here...
Downloads
After all that fiddling, I finally reached the main interface. I have to say, the design really does suit my taste.
Click upload, then try download...

Hmm... This seems to be another reported bug that the developers still haven't fixed.
All right, I'll fix it myself.
The Fix
This is the “typed property must not be accessed before initialization” error introduced in PHP 8. In other words, $size_variant was accessed before being initialized. Maybe Lychee was developed outside a PHP 8 environment. They didn't even initialize a variable...
Lychee runs in a Docker container, so first connect to the server and use docker exec to enter the container.
I found the file mentioned in the error: app/Http/Requests/Album/ZipRequest.php
It uses a trait:
use HasSizeVariantTrait;
The trait defines $size_variant, but it might be overridden or incompatible in ZipRequest.
The variable comes from: app\Http\Requests\Traits\HasSizeVariantTrait.php
Let's look there...

Here, $size_variant clearly isn't defined...
Try just setting it to null:

Then a new error appeared...
/var/www/html/Lychee/app/Http/Controllers/Gallery/AlbumController.php:363
Initializing $size_variant to null got past the uninitialized-property problem, but the variable was eventually passed as a DownloadVariantType enum parameter. The types didn't match, and it blew up.
So redefine it, making sure the $size_variant passed in is a DownloadVariantType enum value, not null.

After the change, run docker restart, refresh again, and finally, fixed.

After all that, Lychee's code really feels... Maybe I should file an issue on GitHub and ask the developers to do more version-compatibility work? Or maybe I've downloaded and am using an old version. Hard to say 😑.
Uploads
I'm back. I've successfully replaced Lychee with lskyPro for image hosting. Lychee can stick to being a gallery and do its exhibition job. 🙃
This post has evolved from using Lychee in a rage to complaining about Lychee calmly and rationally, but the substance hasn't changed: Lychee still isn't great.

That import-from-link option looks tempting, doesn't it?
😾 It's purely decorative!!!
Why doesn't Lychee handle URL resolution on the backend?

(Open the logs. Vision goes dark.)
Changed the DNS, and then...

The lesson: don't casually change DNS in containers with databases.
I configured DNS again in docker-compose.yml, and things went back to normal.

But still no response? I couldn't understand it. curl worked inside the container, so why did Lychee's get fail outright? Then I checked Cloudflare... Fine.

Allowed it through and restarted Docker. Yep, Lychee's import-from-link feature worked again. Everyone's happy. (Skipping over yet another server crash here...)
Testing
Let's try its image-hosting feature.
I accidentally deleted the old photos while updating Lychee... Luckily, they're still on my phone. Let's try the new image host.


I have to say, HNU's campus is rather lovely...
Suddenly, I feel a need for a NAS. But before that, I should probably do a bit more tinkering with myself.

I love reflections in water, and sunsets.