Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExIf-Tag causes error on photo upload #1410

Closed
psycho160 opened this issue Jul 20, 2022 · 8 comments · Fixed by LycheeOrg/php-exif#50 or #1413
Closed

ExIf-Tag causes error on photo upload #1410

psycho160 opened this issue Jul 20, 2022 · 8 comments · Fixed by LycheeOrg/php-exif#50 or #1413
Assignees
Labels
bug Something isn't working

Comments

@psycho160
Copy link

psycho160 commented Jul 20, 2022

Detailed description of the problem [REQUIRED]

If i try to upload photos (taken with a Xiaomi 11T) the upload fails. Log entry says:

PHPExif\Exif::setSoftware(): Argument #1 ($value) must be of type string, null given, called in /var/www/html/Lychee/vendor/lychee-org/php-exif/lib/PHPExif/Hydrator/Mutator.php

Webupload and serverupload same issue.

If i update the ExIf-data from the photo before upload there is no error:

exiftool -overwrite_original -Software=blabla /opt/upload/

Musst be an issue with the "Software" Tag in ExIf Data...

Browser and system




    System Information
    --------------
    Lychee Version (git):            master (7e9cf7c) --  - More than 30 commits behind
    DB Version:                      4.5.1
    
    composer install:                dev
    APP_ENV:                         production
    APP_DEBUG:                       false
    
    System:                          Linux
    PHP Version:                     8.1
    PHP User agent:                  Lychee/4 (https://lycheeorg.github.io/)
    Timezone:                        Europe/Vienna
    Max uploaded file size:          512M
    Max post size:                   512M
    Max execution time:              30
    SQLite Version:                  3.27.2
    
    Imagick:                         1
    Imagick Active:                  1
    Imagick Version:                 1690
    GD Version:                      2.3.3




    Config Information
    --------------
    version:                         040501
    check_for_updates:               1
    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:                            de
    layout:                          1
    image_overlay_type:              desc
    default_license:                 reserved
    compression_quality:             90
    full_photo:                      1
    delete_imported:                 0
    Mod_Frame:                       1
    Mod_Frame_refresh:               30
    thumb_2x:                        1
    small_2x:                        1
    medium_2x:                       1
    landing_page_enable:             0
    landing_owner:                   Philipp
    landing_title:                   Philipp
    landing_subtitle:                Only good Photos
    landing_facebook:                https://www.facebook.com
    landing_flickr:                  
    landing_twitter:                 
    landing_instagram:               https://instagram.com
    landing_youtube:                 
    landing_background:              dist/cat.jpg
    site_title:                      Gallery
    site_copyright_enable:           1
    site_copyright_begin:            2021
    site_copyright_end:              2022
    additional_footer_text:          
    display_social_in_gallery:       0
    public_search:                   0
    SL_enable:                       0
    SL_for_admin:                    0
    public_recent:                   0
    recent_age:                      1
    public_starred:                  0
    downloadable:                    0
    photos_wraparound:               1
    map_display:                     1
    zip64:                           1
    map_display_public:              1
    map_provider:                    Wikimedia
    force_32bit_ids:                 0
    map_include_subalbums:           0
    update_check_every_days:         3
    has_exiftool:                    0
    share_button_visible:            1
    import_via_symlink:              0
    has_ffmpeg:                      1
    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
    map_display_direction:           1
    album_subtitle_type:             oldstyle
    upload_processing_limit:         1
    public_photos_hidden:            1
    new_photos_notification:         0
    legacy_id_redirection:           1

@kamil4
Copy link
Contributor

kamil4 commented Jul 20, 2022

Could you share with us a sample image that demonstrates the problem?

Also, your diagnostics output is incomplete. It would help to at least know the value of the has_exiftool config variable.

@kamil4 kamil4 added the bug Something isn't working label Jul 20, 2022
@psycho160
Copy link
Author

psycho160 commented Jul 20, 2022

IMG_20220720_083253

I updated the system info above and you can find a sample picture in the attachment.

Has_exiftool is 0 but i have installed it on the machine. Hmm..

@qwerty287
Copy link
Contributor

qwerty287 commented Jul 20, 2022

You can change has_exiftool manually in the advanced settings to 1. The setting is only set once, if you didn't have it installed then (and installed it later), it's not updated.

@psycho160
Copy link
Author

Ok, i´ve updated the has_exiftool now manually in the settings to 1. Upload works now! thx

@kamil4
Copy link
Contributor

kamil4 commented Jul 20, 2022

@d7415 @ildyria @nagmat84 @qwerty287 I would like to discuss the best way of fixing this. The issue is that the image supplies a tag (Software in this case) but with a value of null. With the type annotations recently added to php-exif, this no longer works because the method operates only on strings.

My inclination is to use a sledgehammer approach: modify the generic hydrator method https://github.com/LycheeOrg/php-exif/blob/ef77c3767a57ca6792efc19e389642d3d8844958/lib/PHPExif/Hydrator/Mutator.php#L33-L42 so that it ignores all null values, behaving as if tags with such values have not been encountered at all.

exiftool hides this problem by replacing nulls with empty strings. Again, is there a useful use case for "present but empty" values? I'm inclined to treat empty strings same as nulls.

Your thoughts?

@qwerty287
Copy link
Contributor

Sounds good.

@d7415
Copy link
Contributor

d7415 commented Jul 20, 2022

Your thoughts?

Makes sense to me.

@ildyria
Copy link
Member

ildyria commented Jul 20, 2022

Again, is there a useful use case for "present but empty" values? I'm inclined to treat empty strings same as nulls.

Not that I can think of at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants