#Displaying .svg file from Storage
67 messages · Page 1 of 1 (latest)
I think appwrite is using php-imagick under the hood and it has serious security issues with .svg
Probably disabled due to that
I think a good alternative Appwrite could use is libvips
https://www.libvips.org/API/current/How-it-works.html
It has PHP bindings and seems to be fast with very low footprint
A fast image processing library with low memory needs.
It also supports AVIF, HEIC and PDF
I'll open an issue for this 
You should be able to render it in the client with some SVG visualization library
Apart from that, an svg file is not an image, so consequently you can't preview it with the preview endpoint as it's intended to work only with images for now
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
I don't say not
Of course it can?
SVG just contains metadata for a vector like an image data how to display an image
It's not the same. SVG is vector. Images are not vector, but bitmap.
They're both completely different things
What is the issue tho?
It's different ways to show an image. What we human classify as an image
For the machine, vector is not an image 🙂
Webp is
Both are
Yes, I don't know about avif, that's why not confirming 😅
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
Nope, it needs rendering to be shown as an image.
Basically vector -> bitmap
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
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
Because it's not an image 😉
WHAT THE HECK
Dude I got a degree in Media Computer Science what are you trying to prove here
?????????????
I'm not trying to prove anything, just explaining why the preview endpoint is not working for svgs 😅
That ain't the reason but the fact that imagick has CVEs for svg
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
The main reason right now is that
When accessing the view endpoint
What's this?
The SVG file we are talking about
Does this look like an image to you?
or "vector" graphic lol
Nope, only vectors
Same vector file can be displayed properly on other websites
Vector can be shown here or be converted to an actual image file format
Yes, but because the client renders it and converts the traces/vectors into raster
lol
@green shore Do you can create a GitHub issue for this?
I suggest using https://www.libvips.org. It supports a variety of formats. Even newer ones that are heavily requested like AVIF, HEIC, PDF, etc. Also many operations like the ones we currently have in appwrite
A fast image processing library with low memory needs.
But yes I will open an issue for that
There's also some security concerns with rendering svg 😬
Lol I enjoyed reading this chat history 🤣
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?
The mission of the CVE® Program is to identify, define, and catalog publicly disclosed cybersecurity vulnerabilities.
The mission of the CVE® Program is to identify, define, and catalog publicly disclosed cybersecurity vulnerabilities.
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...
This is the story of an image processing library migration in our Content Delivery Network and the performance gain in a real case…
it's all in good fun 😂
Github issue: https://github.com/appwrite/appwrite/issues/8456
🔖 Enhancement description Look at the amount of CVEs from ImageMagick: https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=Imagemagick Total of 672 CVEs Compared to libvips: https://cve.mitre.org/cgi-...
I thought it was just me 🙂 haha