docker icon indicating copy to clipboard operation
docker copied to clipboard

svg support for imagick

Open fuse314 opened this issue 7 years ago • 26 comments

Pull Request #575 has solved adding imagick manually to the container - thank you for this! - but imagick is missing SVG Support. After changing my custom docker image back to the default (nextcloud:15-fpm-alpine), I am now stuck with the blue default favicons. My custom image showed the current app icon with the themed background.

Since I am new to this docker game, I cannot implement this change myself (I basically copy-pasted my code from the example docker files)

  • What packages can I add manually to enable SVG support in imagick?
  • What changes are needed in the official docker file to add support for SVG?
  • Is SVG support something that should be added for everyone (i.E. official docker file) or should it be optional (i.E. add an example in the documentation) ?

fuse314 avatar Jan 03 '19 13:01 fuse314

You need to add libmagickcore-6.q16-3-extra to your image. This will add support for additional formats, including svg, to imagemagick.

For example change the part in the example where all the apt-get installs happen, to include this package:

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        smbclient \
        supervisor \
        # svg support
        libmagickcore-6.q16-3-extra \
    ; \
    rm -rf /var/lib/apt/lists/*

shoetten avatar Jan 12 '19 16:01 shoetten

There's an ongoing discussion in https://github.com/nextcloud/server/issues/13099

J0WI avatar Jan 14 '19 13:01 J0WI

Do you think we could publish another flavor with svg support and notice the user about the security concerns?

kesselb avatar Feb 01 '19 15:02 kesselb

~~I think this does only affect Debian based images, so I filled #634 for consistency.~~

J0WI avatar Feb 01 '19 16:02 J0WI

Looks like this does actually require the imagemagick binary. I've added this to the full example in #634, but I think it's not worth adding this by default (nextcloud/server#13099). You can easily convert the favicon locally to a PNG.

J0WI avatar Feb 01 '19 20:02 J0WI

My point is that if it is "not worth" adding the package by default, why is the pecl extension being installed? As outlined, the extension shows loaded, but with no supported file formats. It used to be that neither the PECL extension or the imagemagick package were included. I have a derived image that I maintain with the added functionality here.

I used to have to add support for imagemagick, until I saw that starting with version 15, both the package and the extension were being included. Not so with 16 tho.

bkraul avatar Jun 04 '19 16:06 bkraul

My point is that if it is "not worth" adding the package by default, why is the pecl extension being installed?

pecl extension "imagemagick" is installed by default. svg support for imagemagick is optional and not installed by default.

kesselb avatar Jun 04 '19 16:06 kesselb

AFAIK imagick is used to speed up thumbnail generation and the imagemagick binary is used for extended file formats like SVG and PDF.

J0WI avatar Jun 05 '19 13:06 J0WI

In nextcloud 17, imagemagick svg support is used to convert various elements like folder icons. the package is missing in the official nextcloud:17-fpm image. The folders and my logo were black after the upgrade to 17.

my workaround:

docker-compose exec nextcloud bash
apt install libmagickcore-6.q16-6-extra
./occ repair # clean frontend caches
docker-compose restart

pgassmann avatar Oct 10 '19 21:10 pgassmann

Thanks, I will try something like this in my fpm-alpine image.

bkraul avatar Oct 10 '19 21:10 bkraul

Actually it seems my problem is a little bit different. The SVG "seems" like it is being rendered but it is incorrectly rendered. I have checked the logs and are not able to see any helpful errors that would point to missing libs or the sort.

SVG Logo: android-chrome-192x192

What it actually renders: image

bkraul avatar Oct 11 '19 01:10 bkraul

You need to add libmagickcore-6.q16-3-extra to your image. This will add support for additional formats, including svg, to imagemagick.

For example change the part in the example where all the apt-get installs happen, to include this package:

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        ffmpeg \
        smbclient \
        supervisor \
        # svg support
        libmagickcore-6.q16-3-extra \
    ; \
    rm -rf /var/lib/apt/lists/*

thanks

zrayev avatar Jan 29 '20 13:01 zrayev

The standard container, without any additional apps, is now complaining about the lack of svg-support for php-imagick, so it might be a good idea to add this after all, even if it is just to ged rid of this suggestion.

ghost avatar Feb 20 '21 08:02 ghost

Yeah, either the warning needs to go or the svg-support needs to be built in. It's unreasonable to expect people to build their own images.

dnv avatar Feb 22 '21 23:02 dnv

svg support should be added, it's required by nextcloud to work properly

eathtespagheti avatar Feb 25 '21 09:02 eathtespagheti

The container with the Tag 21 is also complaining about the missing imagick svg support...+1 for adding it again...please reopen (maybe pin) the issue to avoid duplikats...

bf8392 avatar Feb 25 '21 11:02 bf8392

AFAIK the imagemagick binary is only used to convert SVG favicons (using only default configs). Do I miss something?

J0WI avatar Feb 25 '21 13:02 J0WI

If it is not intended to be supported or included due to vulnerabilities, there should be no use of it or reference to it in the app. This is a rather old issue for me.

bkraul avatar Feb 25 '21 13:02 bkraul

@J0WI will this commit also fix the :21 Tag? =)

bf8392 avatar Feb 25 '21 15:02 bf8392