-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Send images to Imaginary docker to generate previews #24166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
eab296b to
516d824
Compare
|
Quick benchmark in the files app:
Results:
|
|
🤖 beep boop beep 🤖 Here are the logs for the failed build: Status of 35607: failurecheckersShow full log |
|
@PVince81 why not do this as an app? |
No that was the part I also ran into when I wrote an imaginary app to play preview provider. |
because only a prototype for benchmarking, it's easier to push a PR that way. I suspect we might need to tweak the preview manager to make it possible to override the default preview providers, which somehow didn't work when I tested (hence the early "return" in this PR) |
|
|
work to be continued in this app: rullzer/imaginary#1 I'll leave the PR open until we have transferred the tasks and code |
aa2259e to
8d849c0
Compare
|
Benchmarks with s3 and using microtime in the getThumbnail method: Small images (256x256):
Bigger image: HD
So it seems that the overhead from the network is really only worth it for larger images there the multithreading of imaginary really helps. This should be most pictures as taking small 256x356 images is not really a thing anymore |
Use case: When using the fit image transformation, it is helpful to know the size of the resulting image without having to either read the image locally or do another request to the info endpoint. Used in: nextcloud/server#24166 Signed-off-by: Carl Schwan <[email protected]>
|
Found an issue, we don't get the width and height of the generated preview, so we currently assume it's 4096x4096 and this is causing an issue for small images (< 1000x1000) as we then generate an additional preview for nothing. I made a PR upstream h2non/imaginary#382 to solve this |
36640cb to
4c26522
Compare
juliusknorr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works, code looks good as well 👍
|
👍 from me for the changes past my original commits |
CarlSchwan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for the commits not from me 😆
Signed-off-by: Carl Schwan <[email protected]> Co-Authored-by: Vincent Petry <[email protected]>
092ead2 to
9b6a1cc
Compare
|
Fixed the missing phpdoc on |
|
backports? |
no backport, this is a new feature and also brings in a new public interface |
* Return with and heigh of the generated images Use case: When using the fit image transformation, it is helpful to know the size of the resulting image without having to either read the image locally or do another request to the info endpoint. Used in: nextcloud/server#24166 Signed-off-by: Carl Schwan <[email protected]> * Make mimetype support always return true * Add command line option to enable this feature Signed-off-by: Carl Schwan <[email protected]> * refactor: remove deprecated X- prefix in response headers Co-authored-by: Tom <[email protected]>
* Fixed Timeout in readme, 30 ~> 60 (h2non#340) * Fix invalid parameters "-path-prefix" (h2non#344) * fix: small errors in docs (h2non#346) * fix: use proper formatter for usage template (h2non#347) Co-authored-by: Mads Moeller <[email protected]> * Add Cloud Run Button (h2non#362) * Delete app.json * Update README.md * Update README.md * updated docker builder OS to go version 1.17 (h2non#371) * fix(readme): remove gocard obsolete badge * feat(readme): update placeholder description * fix(readme): update fly deploy tutorial * fix(docs): allowed-origins examples h2non#333 * memory leak issue fixed with jemalloc (h2non#381) * exposed palette from GET endpoints (h2non#380) * Updated Dockerfile (h2non#384) 1. Changed base image to bullseye 2. The updated base image contains an updated version of libjemalloc too, so building from source is no longer necessary 3. Updated libvips version too * Added dev container (h2non#385) * Added dev container * Removed irrelevant lines * allow speed from get (h2non#383) * allow speed from get * updating the version to use effor param in libvips * Return with and heigh of the generated images (h2non#382) * Return with and heigh of the generated images Use case: When using the fit image transformation, it is helpful to know the size of the resulting image without having to either read the image locally or do another request to the info endpoint. Used in: nextcloud/server#24166 Signed-off-by: Carl Schwan <[email protected]> * Make mimetype support always return true * Add command line option to enable this feature Signed-off-by: Carl Schwan <[email protected]> * refactor: remove deprecated X- prefix in response headers Co-authored-by: Tom <[email protected]> * Decompression exploit check (h2non#404) * Bump bimg version to 1.1.7 * Add decompression bomb exploit check * Update README with new flag * Fix tests * Fix typos (h2non#405) Found via `codespell -S .git`. --------- Co-authored-by: Julian <[email protected]> Co-authored-by: liuxu <[email protected]> Co-authored-by: 0xflotus <[email protected]> Co-authored-by: Mads Moeller <[email protected]> Co-authored-by: Mads Moeller <[email protected]> Co-authored-by: James Ward <[email protected]> Co-authored-by: Angelo Girardi <[email protected]> Co-authored-by: Tom <[email protected]> Co-authored-by: Vaibhav Sharma <[email protected]> Co-authored-by: Alessandro (Ale) Segala <[email protected]> Co-authored-by: Vaibhav Sharma <[email protected]> Co-authored-by: Carl Schwan <[email protected]> Co-authored-by: SeaaaaaSharp <[email protected]> Co-authored-by: Kian-Meng Ang <[email protected]>
* Return with and heigh of the generated images Use case: When using the fit image transformation, it is helpful to know the size of the resulting image without having to either read the image locally or do another request to the info endpoint. Used in: nextcloud/server#24166 Signed-off-by: Carl Schwan <[email protected]> * Make mimetype support always return true * Add command line option to enable this feature Signed-off-by: Carl Schwan <[email protected]> * refactor: remove deprecated X- prefix in response headers Co-authored-by: Tom <[email protected]>
* Return with and heigh of the generated images Use case: When using the fit image transformation, it is helpful to know the size of the resulting image without having to either read the image locally or do another request to the info endpoint. Used in: nextcloud/server#24166 Signed-off-by: Carl Schwan <[email protected]> * Make mimetype support always return true * Add command line option to enable this feature Signed-off-by: Carl Schwan <[email protected]> * refactor: remove deprecated X- prefix in response headers Co-authored-by: Tom <[email protected]>
This is a preview provider for "image/*" mime types that streams the file data to an Imaginary service, which itself will generate the preview and stream it back.
To test:
Using juliusknorr/nextcloud-docker-dev#59
Some issues/topics:
Preview manager issues
why is the maxX/maxY always 4096 even though the UI is requesting less than 400x400 ? (did I find a bug?)Expected behavior, we crate a big preview first and then with GD resize it :/ Still something to improve and make it possible to also use imaginary to do the later resizing. Also worth investigating if having 4096x4096 has big previews make sense as most/many images have a smaller dimenssion.even if setting only "Preview\Imaginary" in "enabledPreviewProviders", it still doesn't seem to be registered properly due to the other defaults. I was actually expecting "enabledPreviewProviders" to override the defaults.Expected behavior the previews needs to be registered (in core with registerCorePreviews) and then enabled.Imaginary preview topics
$response->getBody() is a string, but should be a stream => solved, post response was missing an arg
optional perf improvement: if we know a file to be on local non-encrypted storage, could send the file path directly to the docker (when running on same instance)
gif not supported, it returns an error. might need more option
seems we do need multipart here, PUT not supported => fixed by sending POST with the actual mime type, not multipart
need to do some perf benchmarks and compare with the "native" way: Send images to Imaginary docker to generate previews #24166 (comment)
do benchmarks with photos app (assuming it uses the PreviewManager)