Lychee icon indicating copy to clipboard operation
Lychee copied to clipboard

Black photos in album (manual error, how to fix?)

Open gardiol opened this issue 1 year ago • 4 comments

I am suffering from many "black" pictures in albums. This is my error since by chance i deleted some images from the upload subfolders in the past.

Due to this, i regenerated all small(x2) and medium(x2) stuff via artisan hoping to fix it. But I still have a lot of "black" images in albums. The images are just fine when i open them.

Example: link to public album

what can i do to fix this? I have full command line access. this comes from a very old installation that i am currently reviving.

(on 4.6.9-rc3, migrated fine from 4.0.6)

gardiol avatar Sep 05 '22 11:09 gardiol

Yes because the artisan command line will only fix images if they are not existing in the DB. You could try the following drastic measure:

DELETE FROM `size_variants` WHERE type > 0 AND type < 5;

Empty the medium, medium2x, small and small2x folders and then execute the thumbnail regeneration command.

I do recommend you do a backup before doing that though as this will delete all the small and medium formats of those images. The regeneration may take some time depending of how many images you host on your library.

ildyria avatar Sep 05 '22 12:09 ildyria

You mean backup the image files or backup the database? I have about 30GB of pictures

gardiol avatar Sep 05 '22 13:09 gardiol

You mean backup the image files or backup the database? I have about 30GB of pictures

Both. The medium and small shouldn't take that much space.

ildyria avatar Sep 05 '22 13:09 ildyria

    Lychee total space:              223.72 GB
    Upload folder space:             223.47 GB
    System total space:              489.11 GB
    System free space:               220.68 GB (45%)

:')

ildyria avatar Sep 05 '22 13:09 ildyria

Ok, i finally had time to run the command.

I removed the folders, run the query (got 82628 changed lines as result) and run: for i in small small2x medium medium2x; do ./artisan lychee:generate_thumbs $i; done

Exactly 22 thumbs per forlder have been generated! I have thounsands of pictures, and now all thumbs in the web page are black.

Beside restoring the backups, is there a different query i could run to fix this?

gardiol avatar Sep 27 '22 06:09 gardiol

Update: i al probably an idiot and just noticed it does process only a limited set of images for each run, so i added a fat "100000" as second option to the artisan command and will report later when it will finish.

Hint: provide some kind of help for the command.... i shouldn't have to dig in to the code to find out.

gardiol avatar Sep 27 '22 06:09 gardiol

The --help and -h shortcuts are actually covered, we can't really do more than that. What would you suggest we add then?

▶ ./artisan lychee:generate_thumbs --help
Description:
  Generate intermediate thumbs if missing

Usage:
  lychee:generate_thumbs <type> [<amount> [<timeout>]]

Arguments:
  type                  thumb name
  amount                amount of photos to process [default: "100"]
  timeout               timeout time requirement [default: "600"]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

And:

▶ ./artisan lychee:generate_thumbs -h    
Description:
  Generate intermediate thumbs if missing

Usage:
  lychee:generate_thumbs <type> [<amount> [<timeout>]]

Arguments:
  type                  thumb name
  amount                amount of photos to process [default: "100"]
  timeout               timeout time requirement [default: "600"]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

ildyria avatar Sep 27 '22 08:09 ildyria

Thank you. So, update: i ran all the small/medium 2x regenerate, but the problem still persist. All black thumbs in albums. I did some hunting with browser dev console and found out that the thumbs point to "thumb2x/xxxxxx.jpeg" URL for the image! And the previous commands didn't regenrate any thumb or thumb2x folder.

Am i missing something here? Should i change something in database? Bear in mind that i upgraded from an old 3.x installation to 4.6.1 rc1.

gardiol avatar Sep 30 '22 06:09 gardiol

The --help and -h shortcuts are actually covered, we can't really do more than that. What would you suggest we add then?

▶ ./artisan lychee:generate_thumbs --help
Description:
  Generate intermediate thumbs if missing

Usage:
  lychee:generate_thumbs <type> [<amount> [<timeout>]]

Arguments:
  type                  thumb name
  amount                amount of photos to process [default: "100"]
  timeout               timeout time requirement [default: "600"]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

And:

▶ ./artisan lychee:generate_thumbs -h    
Description:
  Generate intermediate thumbs if missing

Usage:
  lychee:generate_thumbs <type> [<amount> [<timeout>]]

Arguments:
  type                  thumb name
  amount                amount of photos to process [default: "100"]
  timeout               timeout time requirement [default: "600"]

Options:
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
      --env[=ENV]       The environment the command should run under
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Yeah my bad i missed it. What about the tumbs issue?

gardiol avatar Sep 30 '22 10:09 gardiol

To be clear, restoring the thumb and thumb2x folders fixed it, but is there a way to regenerate it?

gardiol avatar Sep 30 '22 10:09 gardiol

Can you try https://github.com/LycheeOrg/Lychee/pull/1545? lychee:generate_thumbs adds two new sizes there, thumb and thumb2x...

kamil4 avatar Oct 03 '22 17:10 kamil4

If you are not using git to track Lychee, the easiest way to test it may be to replace the file Lychee/app/Console/Commands/GenerateThumbs.php with the contents of https://raw.githubusercontent.com/LycheeOrg/Lychee/789317bd13dc771099c547035edd7b81459afb6d/app/Console/Commands/GenerateThumbs.php

kamil4 avatar Oct 03 '22 17:10 kamil4