Commit Graph

84 Commits (e2ea6d46802255cd1dcdedf0c0d5aeabdcaf283d)

Author SHA1 Message Date
AndyXheli ecd1d5dde2
fix(previews): lower log level when cached preview isn't found
Since this PR #52221 was implemented, the log file has been flooded with warnings stating, "Cached preview not found for file; generating a new preview." This appears to be more of an informational message rather than a warning. This PR will change it from warning to debug

Original PR
#52221

Signed-off-by: AndyXheli <andyxheli@gmail.com>
2025-05-15 07:34:40 +07:00
Louis Chemineau 867be352f3
fix(blurhash): Use preview API to generate the previews
This allows to benefit from all the checks done by the preview API.
This also use the newly introduced `cacheResult` argument to limit disk usage.

Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-05-05 11:13:31 +07:00
Louis Chemineau 2238548278
feat(previews): Support in memory preview request
This allows callers to use the API without increasing the disk usage.

Example: blurhash generation, where we request a preview for all uploaded pictures, but don't want to necessarily store that preview.
Signed-off-by: Louis Chemineau <louis@chmn.me>
2025-05-05 10:38:51 +07:00
nfebe d980e69f74 refactor: Thumbnail Generator logging and tests
Signed-off-by: nfebe <fenn25.fn@gmail.com>
2025-04-23 23:06:28 +07:00
nfebe 6b89838cc2 feat: add logging to preview generation
Signed-off-by: nfebe <fenn25.fn@gmail.com>
2025-04-17 14:24:18 +07:00
provokateurin 9836e9b164
chore(deps): Update nextcloud/coding-standard to v1.3.1
Signed-off-by: provokateurin <kate@provokateurin.de>
2024-09-19 14:21:20 +07:00
Thomas Citharel c2150bd079
feat: Add mimetype into BeforePreviewFetchedEvent event
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2024-09-10 14:05:06 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +07:00
Côme Chilliet ec5133b739 fix: Apply new coding standard to all files
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2024-04-02 14:16:21 +07:00
Git'Fellow ef5f7d0a90 Us strpos() only
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-11-15 00:04:25 +07:00
Git'Fellow 53b84732a3 Check for open_basedir before reading /proc
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2023-11-15 00:04:25 +07:00
Simon L b681cf735a address review
Signed-off-by: Simon L <szaimen@e.mail.de>
2023-11-03 15:27:17 +07:00
Simon L 531f5d1e4f fix semaphore guarding
Signed-off-by: Simon L <szaimen@e.mail.de>
2023-11-03 11:47:12 +07:00
Daniel Hansson da2aad598e
also remove function
Signed-off-by: Daniel Hansson <mailto@danielhansson.nu>
2023-10-02 10:54:36 +07:00
Daniel Hansson b2d105e7ec
Generate all preview sizes for Imaginary
A follow up on https://github.com/nextcloud/server/pull/40670

Based on discussions here: https://github.com/nextcloud/server/issues/38911#issuecomment-1741819188

This fixes the case were not all previews are generated, for example in the activity view: https://github.com/nextcloud/server/issues/38911#issuecomment-1738886106



Signed-off-by: Daniel Hansson <mailto@danielhansson.nu>
2023-09-30 20:08:35 +07:00
JanisPlayer 80abec668b
feat: Imaginary WebP support
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2023-09-02 09:30:37 +07:00
Joas Schilling 4f7de8ed60
fix!: Remove legacy event dispatching Symfony's GenericEvent
Signed-off-by: Joas Schilling <coding@schilljs.com>
2023-07-27 09:57:51 +07:00
Daniel Kesselberg 440f882322
feat: add width, height, crop and mode to BeforePreviewFetchedEvent
user_usage_report keeps a counter for files read.

The app uses

- OC_Filesystem::read hook
- Event listener (the legacy one) for IPreview::EVENT

Request for previews do not trigger the hook, hence the additional event listener.
The thumbnails for a list or grid view should not count, so we need the width and height.

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2023-06-23 16:27:35 +07:00
Robin Appelman 9f1d497a0b
Merge pull request #38261 from fsamapoor/replace_strpos_calls_in_lib_private
Refactors "strpos" calls in  lib/private to improve code readability.
2023-06-01 23:10:00 +07:00
Simon L 6608f84a46
Merge pull request #36692 from nextcloud/throw-exception-to-avoid-division-by-zero
fix(preview-generator): Throw exception before dividing by zero when generating previews
2023-05-17 00:14:42 +07:00
Faraz Samapoor e7cc7653b8 Refactors "strpos" calls in lib/private to improve code readability.
Signed-off-by: Faraz Samapoor <fsamapoor@gmail.com>
2023-05-15 15:17:19 +07:00
Simon L d55a7c619d Fix typos in lib/public subdirectory
Found via `codespell -q 3 -S l10n -L jus ./lib/public`

Signed-off-by: luz paz <luzpaz@github.com>

Update lib/public/Accounts/IAccount.php

Signed-off-by: luz paz <luzpaz@github.com>

Signed-off-by: Simon L <szaimen@e.mail.de>
Co-Authored-By: Côme Chilliet <91878298+come-nc@users.noreply.github.com>
2023-05-10 11:56:34 +07:00
Glandos e542e60dbc try to make linters happy
Signed-off-by: Glandos <bugs-github@antipoul.fr>
2023-04-17 16:29:14 +07:00
Glandos 3440387f0f gather code from small and max preview
use directory listing in both functions to gain 25% speed on run where
every preview already exist.

Signed-off-by: Glandos <bugs-github@antipoul.fr>
2023-04-17 16:29:13 +07:00
Glandos 24c121347a Revert 0e49b40
Signed-off-by: Glandos <bugs-github@antipoul.fr>
2023-04-17 16:29:13 +07:00
Glandos 06a7e90383 improve parameter doc
Signed-off-by: Glandos <bugs-github@antipoul.fr>
2023-04-17 16:29:13 +07:00
Glandos 4954bead1d Ensure max preview image is not null
Signed-off-by: Glandos <bugs-github@antipoul.fr>
2023-04-17 16:29:13 +07:00
Glandos b6c65fee2a php-cs-fix
Signed-off-by: Glandos <bugs-github@antipoul.fr>
2023-04-17 16:29:13 +07:00
Glandos 9b4d5146d5 List preview directory only once
getCachedPreview used to call `getFile`, and this calls `getDirectoryListing` (or underlying function that list directory) to find the file. This was done for every preview spec.
Now, this is done only once at the beginning of the loop, and the array is just iterated when needed to find the correct entry.

Signed-off-by: Glandos <bugs-github@antipoul.fr>
2023-04-17 16:29:13 +07:00
Thomas Citharel e60888d988
fix(preview-generator): Throw exception before dividing by zero when generating previews
If the maximum preview generated gives some kind of invalid IImage, it's dimentions and filename can be set to zero.
And then later we do a division by zero to keep the aspect ratio of the previews.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2023-02-13 16:47:28 +07:00
Côme Chilliet f5c361cf44
composer run cs:fix
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2023-01-20 11:45:08 +07:00
szaimen f9e9cd270d
Limit-number-of-concurrent-preview-generations
Signed-off-by: Bowen Ding <dbw9580@live.com>
Signed-off-by: szaimen <szaimen@e.mail.de>
2022-11-05 16:03:01 +07:00
Julius Härtl 07e94eca6f
Emit typed event when preview is requested
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-10-27 14:31:33 +07:00
Christopher Ng 57c66bf7cb Use Image class from public API
Signed-off-by: Christopher Ng <chrng8@gmail.com>
2022-06-02 00:37:36 +07:00
John Molakvoæ 87ce03db1a
Merge pull request #32410 from nextcloud/bugfix/noid/imaginary-exception 2022-05-20 08:14:17 +07:00
Carl Schwan a5a4e0df1c Fix crop condition
Make sure that when fetching the image from the cache we don't
accidentally fetch the cropped image just because it also start with
256-256

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-05-19 17:25:32 +07:00
Julius Härtl 3742b7392d Add explicit return if getSmallImagePreview fails
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2022-05-19 17:01:01 +07:00
Carl Schwan 05bf8b4445 Fix cropped image generated when not asked
The $crop parameter was not propagated to the imaginary pipeline and
instead it used the smartcrop algorithm always

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
2022-05-17 10:19:54 +07:00
Richard Steinmetz 982c846b11
Fix preview generator trying to recreate an existing folder
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
2022-05-09 17:30:07 +07:00
John Molakvoæ 3d1f22f6d8
Generate small preview straight away if Imaginary is enabled
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
2022-04-06 18:55:48 +07:00
Vincent Petry 9b6a1cc8ae
Send images to imaginary docker to generate previews
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Co-Authored-by: Vincent Petry <vincent@nextcloud.com>
2022-03-17 08:24:07 +07:00
John Molakvoæ (skjnldsv) 40c10ab145
Properly log errors in Movie previews generation
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-08-19 09:47:12 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
J0WI 74a7c2eefc Use correct getSystemValue type
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
2021-04-12 22:54:50 +07:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +07:00
Scott Dutton b12a390220
Always try and show pre rendered preview
Currently if the following situation happens

Server generates preview
Server has command removed which allows a preview to be shown
Client asks for preview, gets a 404 error when preview exists
(Mime checked before preview)

This happens more often with documents, or video as the commands are not
native PHP, they require a binary on the server.

After the fix the following would happen

Server generates preview
Server has command removed which allows a preview to be shown
Client asks for preview, gets preview which has been generated
(Mime checked after preview)

This would also allow offline generation (for example a docker image
containing the extra binaries), allowing a reduction in attack surface
of the instance serving the preview data.

Signed-off-by: Scott Dutton <scott@exussum.co.uk>
2020-08-13 22:50:38 +07:00
Morris Jobke f510da139f
Use class that actually has the destroy() method in preview generator
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2020-08-05 15:52:40 +07:00
Elijah Martin-Merrill 56ed563b0c fix memory leak caused by not destroying image in Preview/Generate.php
Signed-off-by: Elijah Martin-Merrill <elijah@nyp-itsours.com>
2020-07-27 10:52:44 +07:00
Christoph Wurst cb057829f7
Update license headers for 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-29 11:57:22 +07:00