#Displaying .svg file from Storage

67 messages · Page 1 of 1 (latest)

outer matrix
#

Hi, I am not able to display .svg files. (using the URL)
Do you have any updates?

green shore
#

I think appwrite is using php-imagick under the hood and it has serious security issues with .svg

#

Probably disabled due to that

#

It also supports AVIF, HEIC and PDF

#

I'll open an issue for this appwritepeepo

cold gazelle
cold gazelle
#

But it would be great to have previews of other stuff such as pdf, svg, etc

#

If someone can, it will be great to create a GitHub issue for this

green shore
#

Huh?

#

Of course svg can be previewed

cold gazelle
green shore
#

Of course it can?

cold gazelle
#

But that's generating an image

#

Basically

#

Or modifying the svg itself

green shore
#

SVG just contains metadata for a vector like an image data how to display an image

cold gazelle
#

It's not the same. SVG is vector. Images are not vector, but bitmap.

They're both completely different things

green shore
#

What is the issue tho?

#

It's different ways to show an image. What we human classify as an image

cold gazelle
green shore
#

wtf

#

So avif and webp arent images too? Because they are not shown previews too

cold gazelle
#

Webp is

green shore
#

Both are

cold gazelle
#

Yes, I don't know about avif, that's why not confirming 😅

green shore
#

What is even your point? Like it can't be shown as image?

#

Nextcloud and other solutions are capable of showing preview images for files like PDF, etc.

#

Of course Vector != Raster image but you are missing the point

cold gazelle
#

But the point of svgs and vectorial formats is to be rendered on the device instead of the cloud, so you see it with a proper resolution despite your screen size/resolution

green shore
#

Dude what is your point?

#

Of corse it can be shown what the heck

cold gazelle
# green shore Dude what is your point?

The point of the preview endpoint is image transformation (changing image resolution/size, compression and format/extension).

Images (bitmap) have resolution.
Vector doesn't have resolution at all

green shore
#

So?

#

Dude there is literally no image shown for svg

cold gazelle
green shore
#

WHAT THE HECK

#

Dude I got a degree in Media Computer Science what are you trying to prove here

#

?????????????

cold gazelle
#

I'm not trying to prove anything, just explaining why the preview endpoint is not working for svgs 😅

green shore
#

That ain't the reason but the fact that imagick has CVEs for svg

cold gazelle
#

Probably the reason in the case of the console is that the fronted just doesn't support it as it should render the svg instead of an image.

#

But

#

Yes

green shore
cold gazelle
#

The main reason right now is that

green shore
#

When accessing the view endpoint

cold gazelle
green shore
#

The SVG file we are talking about

#

Does this look like an image to you?

#

or "vector" graphic lol

cold gazelle
green shore
#

Same vector file can be displayed properly on other websites

#

Vector can be shown here or be converted to an actual image file format

cold gazelle
#

Yes, but because the client renders it and converts the traces/vectors into raster

green shore
#

lol

cold gazelle
green shore
#

But yes I will open an issue for that

golden raptor
#

There's also some security concerns with rendering svg 😬

patent sandal
#

Lol I enjoyed reading this chat history 🤣

green shore
# golden raptor There's also some security concerns with rendering svg 😬

Yes, that's somewhat a general issue with svgs. In the case of imagemagick I can understand that this is disabled by default.
Because well ...,
Look at their amount of CVEs: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=Imagemagick
672
Compared to libvips: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=libvips
9
And libvips ain't a new library either. Both libraries existed since the 90s.

Rails as well as many other frameworks have switched from imagemagick to libvips:
https://github.com/rails/rails/pull/42744

Libvips
It can handle larger resolutions / file sizes.
It is way faster.
It uses way less memory.
Its compression is better.
It scales better and makes use of more cores / threads.
Source: https://medium.com/@pond5-technology/our-journey-to-an-optimised-image-management-library-81aeed079532#:~:text=In the above graph%2C we,50%25 in comparison to ImageMagick.
Another source: https://techblog.criteo.com/boosting-image-processing-performance-from-imagemagick-to-libvips-268cc3451d55

Regarding performance and memory usage, here libvips own benchmark:
Source: https://github.com/libvips/libvips/wiki/Speed-and-memory-use

It has a pro-active community and supports many formats that are heavily requested in the appwrite community.
PDF, HEIC, AVIF, WEBP (only partially implemented in Appwrite I think?) and many more...

And it has PHP bindings 😄

I touched some grass yesterday so I haven't managed creating an issue yet, lol. But I think these are very compelling arguments to make a switch, no?

GitHub

Summary
Changes the default variant processor from :mini_magick to :vips.
Other Information
For the full, paragraphs long, explanation about my experiences with both and why I believe vips is the b...

Medium

This is the story of an image processing library migration in our Content Delivery Network and the performance gain in a real case…

green shore
acoustic urchin