Skip to content

[Bug]: Avatar New style looks weird #34006

Closed

Description

@AndyXheli

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

image image

Steps to reproduce

After this was implemented #33752

Expected behavior

Should look more clear. Th users back end is running LDAP @CarlSchwan what do you think?

Installation method

No response

Operating system

No response

PHP engine version

No response

Web server

No response

Database engine version

No response

Is this bug present after an update or on a fresh install?

No response

Are you using the Nextcloud Server Encryption module?

No response

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

No response

List of activated Apps

Na

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Activity

  1. added
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Sep 9, 2022
  2. changed the title [-][Bug]: Avatar New style logs weird[/-] [+][Bug]: Avatar New style looks weird[/+] on Sep 9, 2022
  3. added and removed
    0. Needs triagePending check for reproducibility or if it fits our roadmap
    on Sep 9, 2022
  4. AndyXheli commented on Sep 19, 2022

    @AndyXheli
    ContributorAuthor

    Not fixed in NC 25 Beta 7

    Same results

    imageimage

  5. CarlSchwan commented on Sep 19, 2022

    @CarlSchwan
    Member

    Oh now I see the issue, it wasn't about dark theme but the weird border

  6. AndyXheli commented on Sep 19, 2022

    @AndyXheli
    ContributorAuthor

    Let me know if you have a manual patch you'd like to me test out

  7. AndyXheli commented on Sep 26, 2022

    @AndyXheli
    ContributorAuthor

    Hello still having this issue on NC 25 RC1

  8. 18 remaining items

  9. skjnldsv commented on Nov 24, 2022

    @skjnldsv
    Member

    @come-nc ring a bell? Maybe a difference in parameters between 8.0 and 8.1?

  10. AndyXheli commented on Nov 24, 2022

    @AndyXheli
    Author
  11. come-nc commented on Nov 28, 2022

    @come-nc
    Contributor

    @come-nc ring a bell? Maybe a difference in parameters between 8.0 and 8.1?

    Hum, kind of. I remember having a problem with gd or imagick changing result is some PHP version.

  12. come-nc commented on Nov 28, 2022

    @come-nc
    Contributor

    I have this test script left over on my disk, which indicates I did have trouble with this:

    <?php
    
    $font = '/usr/share/fonts/truetype/noto/NotoSans-Regular.ttf';
    
    var_dump(imagettfbbox(12, 0, $font, 'E'));
    

    But I’m failing to find any more information on this.
    All I can see is I have commands in my history to check which version of gd/freetype is linked to my PHP build. So I can only advise to test the result of imagettfbbox and compare it accross PHP versions and setups.

  13. come-nc commented on Nov 28, 2022

    @come-nc
    Contributor

    Here is what I have locally:

    > php ~/dev/test-freetype.php
    array(8) {
      [0]=>
      int(1)
      [1]=>
      int(0)
      [2]=>
      int(8)
      [3]=>
      int(0)
      [4]=>
      int(8)
      [5]=>
      int(-11)
      [6]=>
      int(1)
      [7]=>
      int(-11)
    }
    > php --info|grep -i gd
    /etc/php/8.1/cli/conf.d/20-gd.ini,
    gd
    GD Support => enabled
    GD headers Version => 2.3.0
    GD library Version => 2.3.0
    gd.jpeg_ignore_warning => 1 => 1
    > php --info|grep -i freetype
    FreeType Support => enabled
    FreeType Linkage => with freetype
    

    And with my PHP 8.2 built from source for tests:

    > ~/dev/php-src-git/sapi/cli/php ~/dev/test-freetype.php
    array(8) {
      [0]=>
      int(1)
      [1]=>
      int(0)
      [2]=>
      int(8)
      [3]=>
      int(0)
      [4]=>
      int(8)
      [5]=>
      int(-12)
      [6]=>
      int(1)
      [7]=>
      int(-12)
    }
    > ~/dev/php-src-git/sapi/cli/php --info|grep -i gd
    Configure Command =>  './configure'  '--with-ldap' '--with-ldap-sasl' '--with-zip' '--with-curl' '--with-openssl' '--with-zlib' '--enable-mbstring' '--enable-pcntl' '--enable-intl' '--with-password-argon2' '--with-freetype' '--with-jpeg' '--enable-gd' '--with-imagick' '--enable-exif'
    gd
    GD Support => enabled
    GD Version => bundled (2.1.0 compatible)
    gd.jpeg_ignore_warning => On => On
    > ~/dev/php-src-git/sapi/cli/php --info|grep -i freetype
    Configure Command =>  './configure'  '--with-ldap' '--with-ldap-sasl' '--with-zip' '--with-curl' '--with-openssl' '--with-zlib' '--enable-mbstring' '--enable-pcntl' '--enable-intl' '--with-password-argon2' '--with-freetype' '--with-jpeg' '--enable-gd' '--with-imagick' '--enable-exif'
    FreeType Support => enabled
    FreeType Linkage => with freetype
    FreeType Version => 2.11.1
    

    So there is a 1 pixel difference between my 2 local versions already.

  14. szaimen commented on Nov 28, 2022

    @szaimen
    Contributor

    Interesting! So is the issue maybe only reproducible on php 8.0 and below?

  15. come-nc commented on Nov 28, 2022

    @come-nc
    Contributor

    No I think it depends upon which gd and/or freetype version is used. We need to test on as many setups as possible to see common patterns.

  16. AndyXheli commented on Jan 17, 2023

    @AndyXheli
    ContributorAuthor

    Still an issue on NC 25.0.3

  17. schiessle commented on Mar 27, 2023

    @schiessle
    Member

    In case some of the devs need a instance to reproduce it. The problem also exists on the LTD's on try.nextcloud.com

  18. AndyXheli commented on Mar 29, 2023

    @AndyXheli
    Author
  19. AndyXheli commented on Jun 14, 2023

    @AndyXheli
    ContributorAuthor

    Still an issue NC 27

  20. AndyXheli commented on Jul 20, 2023

    @AndyXheli
    ContributorAuthor

    Still an issue on NC 27.0.1 tried below and cleared cache still an issue

    # cd into your appdata avatar directory
    cd data/appdata_xxxxx/avatar
    
    # look for generated avatar and delete their containing directory
    find -name 'generated' -type f -execdir pwd \; | xargs -d '\n' rm -rfv
    
    # update file cache to make Nextcloud generate them again on demand
    occ files:scan-app-data avatar
    
  21. danxuliu commented on Jul 28, 2023

    @danxuliu
    Member

    The problem is in ImageMagick itself; before ImageMagick 6.9.10-36 (specifically, ImageMagick/ImageMagick6@3b6ba12), if the internal renderer is used (that is, if ImageMagick is built with --without-rsvg and Inkscape is not in $PATH), the SVG used for avatars in Nextcloud is not properly rendered.

    To check this, first save the SVG of a Nextcloud avatar in a test.svg file:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <svg width="64" height="64" version="1.1" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg">
    	<rect width="100%" height="100%" fill="#e8f1f8"></rect>
    	<text x="50%" y="350" style="font-weight:normal;font-size:280px;font-family:'Noto Sans';text-anchor:middle;fill:#1e78c1">U</text>
    </svg>
    

    Then, build ImageMagick 6.9.10-35 and 6.9.10-36 and check the generated PNG file (note that you will need to replace {PATH-TO-THE-DIRECTORY-OF-THE-TEST-SVG-FILE} with the proper value):

    docker run --detach --interactive --tty --volume {PATH-TO-THE-DIRECTORY-OF-THE-TEST-SVG-FILE}:/tmp/imagemagick-test --name imagemagick-test ubuntu:20.04 bash
    docker exec imagemagick-test bash -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes build-essential git autoconf pkg-config libxml2-dev libfreetype6-dev libfontconfig1-dev gsfonts"
    docker exec imagemagick-test bash -c "useradd --create-home imagemagick"
    docker exec --user imagemagick --workdir /home/imagemagick imagemagick-test bash -c "git clone https://github.com/ImageMagick/ImageMagick6"
    docker exec --user imagemagick --workdir /home/imagemagick/ImageMagick6 imagemagick-test bash -c "git checkout 6.9.10-35"
    docker exec --user imagemagick --workdir /home/imagemagick/ImageMagick6 imagemagick-test bash -c "mkdir build && cd build/ && ../configure --without-rsvg && make && MAGICK_CONFIGURE_PATH=/home/imagemagick/ImageMagick6/config:/home/imagemagick/ImageMagick6/build/config ./utilities/convert /tmp/imagemagick-test/test.svg /tmp/imagemagick-test/test-6.9.10-35.png && cd .."
    docker exec --user imagemagick --workdir /home/imagemagick/ImageMagick6 imagemagick-test bash -c "git checkout . && git checkout 6.9.10-36"
    docker exec --user imagemagick --workdir /home/imagemagick/ImageMagick6 imagemagick-test bash -c "cd build/ && ../configure --without-rsvg && make && MAGICK_CONFIGURE_PATH=/home/imagemagick/ImageMagick6/config:/home/imagemagick/ImageMagick6/build/config ./utilities/convert /tmp/imagemagick-test/test.svg /tmp/imagemagick-test/test-6.9.10-36.png && cd .."
    

    To solve the issue you need to update ImageMagick to, at least, ImageMagick 6.9.10-36. If you are using Ubuntu 20.04 you can upgrade to Ubuntu 22.04, which uses ImageMagick 6.9.11-60 and therefore no longer has this issue.

    ImageMagick renders SVG files using either its internal render, rsvg-convert or Inkscape, so if you are in an old ImageMagick version and you can not update it you might be able to work around the issue just installing Inkscape.

    You could also rebuild ImageMagick with RSVG support, so it renders the SVG files through rsvg-convert rather than its internal renderer. However it seems that rsvg-convert has its own issues and it is not currently used when generating the avatars.

    Alternatively, if your distributon provides SVG support for ImageMagick in an additional package (for example, libmagickcore-6.q16-6-extra in Ubuntu 20.04), you can also remove that package to remove support for SVG from ImageMagick; GD will be used instead of ImageMagick to generate the avatars and they will look as expected. The drawback is, however, that you may lose some other feature that depend on SVG support in ImageMagick, like theming icons.

    Finally, note that the rendering was wrong too with the old avatar style, but since Nextcloud 16 the problem was not visible because the font could not be found (the path to the font was not updated when lib/private/Avatar.php was moved to lib/private/Avatar/Avatar.php) and thus it always ended being rendered with GD; with the new avatar style the path got fixed and thus the problem appeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions