LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.35k stars 299 forks source link

Some albums do NOT have the (random) header picture #2196

Closed LudovicRousseau closed 9 months ago

LudovicRousseau commented 9 months ago

Detailed description of the problem

With some of my albums I do not have a random header picture in the album view. The header is just black.

For some albums I have a header picture. The picture is random and changes if I reload the page. But for some albums I get no header. I have not found what is special for some of my albums.

I have no error or warnings in my Lychee logs.

I compared 2 HTML pages: 1 with a working header and 1 with the problem. In the page with the problem the HTML code contains at line 955:

<!--[if BLOCK]><![endif]--> <!--[if ENDBLOCK]><![endif]-->                <div class="w-full px-7 my-4 flex flex-row-reverse" x-show="! albumFlags.isDetailsOpen" x-transition.opacity >

On the working page instead I have:

<!--[if BLOCK]><![endif]--><div class="w-full h-1/2 text-text-main-200 relative" x-show="! albumFlags.isDetailsOpen" >
    <img class="absolute block top-0 left-0 w-full h-full object-cover object-center z-0" src="[https://images2.xxxx.fr/Lychee/uploads/medium/3e/5e/eb94079b34ff76ecfe5eb731f21a.jpg](view-source:https://images2.xxxx.fr/Lychee/uploads/medium/3e/5e/eb94079b34ff76ecfe5eb731f21a.jpg)">
    <div class="h-full pl-7 pt-7 relative text-shadow-sm w-full bg-gradient-to-b from-black/20 via-80%">
        <h1 class="font-bold text-4xl text-text-main-0">2014-11 Cassis</h1>
        <!--[if BLOCK]><![endif]-->        <span class="text-text-main-200 text-sm">November 2014
            <!--[if BLOCK]><![endif]--> <!--[if ENDBLOCK]><![endif]-->
        </span>
         <!--[if ENDBLOCK]><![endif]-->
    </div>
</div>
 <!--[if ENDBLOCK]><![endif]-->                <div class="w-full px-7 my-4 flex flex-row-reverse" x-show="! albumFlags.isDetailsOpen" x-transition.opacity >

Steps to reproduce the issue

  1. Go to an album
  2. see no header picture

Screenshots no header

Output of the diagnostics

    Diagnostics
    -----------
        Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/ has permissions 0775, but should have 2775
        Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/thumb has permissions 0775, but should have 2775
        Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/thumb/46 has permissions 0775, but should have 2775
        Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/thumb/46/4d has permissions 0775, but should have 2775
        Warning: /home/rousseau/Serveurs_web/Lychee/Lychee/public/uploads/thumb/46/86 has permissions 0775, but should have 2775
        Warning: 6711 more directories with wrong permissions
        Warning: Dropbox import not working. dropbox_key is empty.
        Info: Latest version of PHP is 8.3

    System Information
    ------------------
        Lychee Version (release):                5.0.3
        DB Version:                              5.0.3

        composer install:                        --no-dev
        APP_ENV:                                 production
        APP_DEBUG:                               false
        APP_URL:                                 set
        APP_DIR:                                 set
        LOG_VIEWER_ENABLED:                      true
        LIVEWIRE_ENABLED:                        true

        System:                                  Linux
        PHP Version:                             8.2.7
        PHP User agent:                          Lychee/4 (https://lycheeorg.github.io/)
        Timezone:                                Europe/Paris
        Max uploaded file size:                  500M
        Max post size:                           500M
        Livewire chunk size:                     12.00 MB
        Max execution time:                      200
        MySQL Version:                           10.11.4-MariaDB-1~deb12u1

        exec() Available:                        yes
        Imagick Available:                       1
        Imagick Enabled:                         1
        Imagick Version:                         1691
        GD Version:                              2.3.3
        Number of foreign key:                   11 found.

    Config Information
    ------------------
        version:                                 050003
        check_for_updates:                       0
        sorting_photos_col:                      taken_at
        sorting_photos_order:                    ASC
        sorting_albums_col:                      max_taken_at
        sorting_albums_order:                    ASC
        imagick:                                 1
        skip_duplicates:                         0
        small_max_width:                         0
        small_max_height:                        360
        medium_max_width:                        1920
        medium_max_height:                       1080
        lang:                                    fr
        image_overlay_type:                      date
        default_license:                         reserved
        compression_quality:                     90
        grants_full_photo_access:                1
        delete_imported:                         0
        mod_frame_enabled:                       1
        mod_frame_refresh:                       30
        thumb_2x:                                1
        small_2x:                                1
        medium_2x:                               1
        landing_page_enable:                     0
        site_owner:                              Ludovic Rousseau
        landing_title:                           John Smith
        landing_subtitle:                        Cats, Dogs & Humans Photography
        sm_facebook_url:                         https://www.facebook.com/JohnSmith
        sm_flickr_url:                           https://www.flickr.com/JohnSmith
        sm_twitter_url:                          https://www.twitter.com/JohnSmith
        sm_instagram_url:                        https://instagram.com/JohnSmith
        sm_youtube_url:                          https://www.youtube.com/JohnSmith
        landing_background:                      dist/cat.webp
        site_title:                              Lychee v5
        footer_show_copyright:                   1
        site_copyright_begin:                    2012
        site_copyright_end:                      2019
        footer_additional_text:                  
        footer_show_social_media:                0
        search_public:                           0
        SL_enable:                               0
        SL_for_admin:                            0
        recent_age:                              1
        grants_download:                         0
        photos_wraparound:                       1
        map_display:                             1
        zip64:                                   1
        map_display_public:                      1
        map_provider:                            Wikimedia
        force_32bit_ids:                         0
        map_include_subalbums:                   1
        update_check_every_days:                 3
        has_exiftool:                            0
        share_button_visible:                    0
        import_via_symlink:                      0
        has_ffmpeg:                              0
        location_decoding:                       1
        location_decoding_timeout:               30
        location_show:                           1
        location_show_public:                    1
        rss_enable:                              0
        rss_recent_days:                         7
        rss_max_items:                           100
        prefer_available_xmp_metadata:           0
        editor_enabled:                          1
        lossless_optimization:                   0
        swipe_tolerance_x:                       150
        swipe_tolerance_y:                       250
        local_takestamp_video_formats:           .avi|.mov
        log_max_num_line:                        1000
        unlock_password_photos_with_url_param:   0
        nsfw_visible:                            1
        nsfw_blur:                               0
        nsfw_warning:                            0
        nsfw_warning_admin:                      0
        nsfw_banner_override:                    
        map_display_direction:                   1
        album_subtitle_type:                     oldstyle
        upload_processing_limit:                 4
        new_photos_notification:                 0
        legacy_id_redirection:                   1
        zip_deflate_level:                       6
        SA_enabled:                              1
        default_album_protection:                1
        album_decoration:                        layers
        album_decoration_orientation:            row
        allow_username_change:                   1
        auto_fix_orientation:                    1
        use_job_queues:                          0
        random_album_id:                         starred
        use_last_modified_date_when_no_exif_date: 0
        ffmpeg_path:                             
        ffprobe_path:                            
        layout:                                  square
        date_format_photo_thumb:                 M j, Y, g:i:s A e
        date_format_photo_overlay:               M j, Y, g:i:s A e
        date_format_sidebar_uploaded:            M j, Y, g:i:s A e
        date_format_sidebar_taken_at:            M j, Y, g:i:s A e
        date_format_hero_min_max:                F Y
        date_format_hero_created_at:             M j, Y, g:i:s A T
        date_format_album_thumb:                 M Y
        upload_chunk_size:                       0
        nsfw_banner_blur_backdrop:               0
        search_pagination_limit:                 1000
        search_minimum_length_required:          4
        photo_layout_justified_row_height:       320
        photo_layout_masonry_column_width:       300
        photo_layout_grid_column_width:          250
        photo_layout_square_column_width:        200
        photo_layout_gap:                        12
        display_thumb_album_overlay:             always
        display_thumb_photo_overlay:             hover
        default_album_thumb_aspect_ratio:        1/1
        use_album_compact_header:                0
        login_button_position:                   left
        back_button_enabled:                     0
        back_button_text:                        Return to Home
        back_button_url:                         /

Browser and system

ildyria commented 9 months ago

Header image is only available if there are pictures in the album (i.e. if only sub albums => no pictures). Then the selection is done randomly on the landscape ones.

There are some ideas to make that header picture static similar to the cover one.

LudovicRousseau commented 9 months ago

But I have pictures in the album. You can see them in the screen capture.

ildyria commented 9 months ago

But I have pictures in the album. You can see them in the screen capture.

Is there any of them in Landscape? they might all be portrait.

LudovicRousseau commented 9 months ago

I don't know how Lychee identify a landscape image. But they are not all in portrait mode. no header 2

ildyria commented 9 months ago

Would you be able to check the database for values in the size_variants table. There should be a ratio column which in theory was computed from: https://github.com/LycheeOrg/Lychee/blob/master/database/migrations/2023_07_07_143908_add_ratio_size_variants.php

LudovicRousseau commented 9 months ago

For the 1st picture I have: sql

ildyria commented 9 months ago

so medium does not exists!

ildyria commented 9 months ago
return SizeVariant::query()
    ->where('type', '=', SizeVariantType::MEDIUM)
    ->whereBelongsTo($this->album->photos)
    ->where('ratio', '>', 1)
    ->inRandomOrder()
    ->first();
ildyria commented 9 months ago

I don't think medium will be generated either given how small the original is (medium is by default 1920x1080).

LudovicRousseau commented 9 months ago

Ah, good point. I had a look at different albums and for the albums with the problem the pictures do NOT have the medium size in the size_variants table.

Maybe the "small2x" or "small" sizes could be used as a fallback?

ildyria commented 9 months ago

small2x could be, but small is really too... small.