Uh oh!
There was an error while loading. Please reload this page.
Jpeg use imagick - #16158
Conversation
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Signed-off-by: nachoparker <nacho@ownyourbits.com>
| } | ||
| } | ||
| // TODO move to a new file |
There was a problem hiding this comment.
👍 There is a script to update the autoloaders: https://github.com/nextcloud/server/blob/master/build/autoloaderchecker.sh
Signed-off-by: nachoparker <nacho@ownyourbits.com>
Uh oh!
There was an error while loading. Please reload this page.
kesselb
commented
Jul 2, 2019
Thank you for your research 👍 🚀 |
jospoortvliet
commented
Jul 4, 2019
@rullzer your input needed for the security side of it, I suppose... |
phpbg
commented
Sep 1, 2019
Hi,
In the end, I guess we need:
|
rullzer
commented
Sep 1, 2019
I'm not a big fan of enabling imagick so widely with user input. I have been playing (but time... you know) of making the preview backend more replacable and plugin capable. So you could for example use some 3rdparty service for preview generation. Or have more modular in general to also allow generation of more modern types (for browsers that support it etc). So I'm not against chaing the preview system. But then we should have it more pluggable so this doesn't have to all be fixed in the server. |
nachoparker
commented
Sep 15, 2019
We basically are saying similar things. I don't care what we use but this needs to be improved. User experience is very bad and one of the most popular things people want to use NC for is for their photo collection, then they get instantly turned off. It works awfully. I wrote down a bunch of ideas while I was looking around this issue. Off the top of my head things that could be done:
About using a different library... I am fine with that. I do not particularly advocate for imagick but wanted to test out multithreading to see if it would help. I think that a library that can do multithread and a config option would be handy. I am not inside the project that much to say what needs to be done, but I wanted to start this conversation since the current situation makes NC look pretty bad to users. Then there is the problem of the NC architecture, which is highly inefficient for the gallery since it has to spawn a thread and load everything including apps for every request, but that would be a separate issue. See #14953 |
skjnldsv
commented
Sep 28, 2019
@rullzer we do encourage imagick though, as this is needed for proper avatar generation too :) |
iskradelta
commented
Oct 19, 2019
The security concerns with imagick can be solved, by placing it in a seccomp mode, with only a whitelist of system calls allowed, perhaps even seccomp mode 2 would be enough. |
rullzer
commented
Nov 19, 2019
So. I have been playing with this as well a bit. So again. I do not like imagick. My approach has been playing with https://github.com/h2non/imaginary which is insanely fast. And nicely sandboxed in docker. (yay!). The issue right now is that we can use that for the initial preview but for the scaling as pointed out here GD is still used. What I would suggest we do
Does that sound somewhat sane? |
kesselb
commented
Nov 19, 2019
Yes 👍 I guess the structural changes will take some time. Adding a way to use imagick for preview generation sounds good to me in the meantime. With some code cleanup I would accept this pr. As long as there is a way to opt out. |
| $image = new OCPImage(); | ||
| public function getImage($maxPreview) { | ||
| $mimeType = $maxPreview->getMimeType(); | ||
| $imagick_mode = (bool)$this->config->getSystemValue('preview_use_imagick', false); |
There was a problem hiding this comment.
| $imagick_mode = (bool)$this->config->getSystemValue('preview_use_imagick', false); | |
| $imagick_mode = $this->config->getSystemValueBool('preview_use_imagick', false) && extension_loaded('imagick'); |
mailinglists35
commented
Sep 19, 2020
@nachoparker is the PR applying cleanly on 19.0.3? Waiting for current previewgenerator to only use a small percent of 1 of 8 cpus is not a pleasant experience. I tried to apply your PR like this: went to Commit tab of this PR, right click on each one commit, copy link. went to shell, wget copied_url and append ".patch", like this
then cd /var/www/nextcloud; patch --dry-run -p1 < /root/20ac35e01351cb79b2c00545c444c8d7c94c6ab6.patch but it fails like this: |
This comment has been minimized.
This comment has been minimized.
woutergrimme
commented
May 12, 2021
Any update on this? |
h4knet
commented
Jul 30, 2021
Hello, I'm discovering this thread while I was looking for a solution about the very slowly loading thumbnails on my server/NC clients (I'm already using APCu). Is the work done by @nachoparker has been integrated into NC ? I'm running NC 20 and previewgenerator is still using 1 CPU but I wonder if NC does use more CPU's when it generates preview on the fly. |
J0WI
commented
Jul 30, 2021
Quoting myself from #13099 (comment):
There is a |
J0WI
commented
Aug 4, 2021
This might be related to #15075 |
CarlSchwan
commented
Dec 10, 2021
It seems like a popular approach nowadays is to run the preview generator inside a separate docker with software based on libvips e.g. https://github.com/h2non/imaginary or https://github.com/cshum/imagor If we move the preview generation to a separate process this might also help a bit with the performances... libvips is part of OSS Fuzz and is contently fuzzed for potential new vulnerabilities so this should hopefully reduce the risks a bit with additionally running it in a docker image. |
This would break the concept of user key encryption. |
PVince81
commented
Feb 22, 2022
we have work in progress to generate previews faster using imaginary: #24166 |
skjnldsv
commented
Feb 27, 2024
As there is no feedback since a while I will close this ticket. @nachoparker thanks for the work put into Nextcloud (this PR might not be in, but many of others from you are 🤗) |
See nachoparker#1
My main intention is to try to improve performance by using a native method and explore multithreaded native approaches.
I am not necessarily advocating for Imagick, since I know there are security concerns around it, but I wanted to start the conversation since the performance is really bad and throws people off.
This is a PoC, but we could do something like this with some native library that is not GD to start working towards that direction. All being said I was impressed to find out that GD was not that much slower in equal conditions (single threaded and so on), which probably doesn't say much about Imagick.
It would be interesting to try out other libraries too.