Commit Graph

74 Commits (296096e06996aee1a06d901b99adde5f04688f58)

Author SHA1 Message Date
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
Roeland Jago Douma eba3726e1e
Merge pull request #19495 from nextcloud/preview-generate-batch
optimize batch generation of previews
2020-04-10 15:57:06 +07:00
Robin Appelman 8f9bac26f8
fix preview generation tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-10 13:39:45 +07:00
Christoph Wurst 14c996d982
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-10 10:35:09 +07:00
Robin Appelman 7d386872e5
optimize batch generation of previews
by allowing the generation of multiple previews at once we save on having to find, open and decode the max-preview for every preview of the same file

the main use case for this is the preview generator app (pr for that comming next)

in my local testing this saves about 25% of time when using the preview generator app

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-09 12:50:59 +07:00
Robin Appelman 5cd12cd7c3
allow generating multiple preview sizes for a single file at once
this saves having to do some of the overhead multiple times

Signed-off-by: Robin Appelman <robin@icewind.nl>
2020-04-09 12:50:55 +07:00
Christoph Wurst 2fbad1ed72
Fix (array) indent style to always use one tab
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-04-09 10:16:08 +07:00
Christoph Wurst 74936c49ea
Remove unused imports
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-25 22:08:08 +07:00
John Molakvoæ (skjnldsv) 6df44e407a
Also center vertically when cropping previews
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2019-12-22 15:07:11 +07:00
Christoph Wurst 5bf3d1bb38
Update license headers
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2019-12-05 15:38:45 +07:00
Roeland Jago Douma 68748d4f85
Some php-cs fixes
* Order the imports
* No leading slash on imports
* Empty line before namespace
* One line per import
* Empty after imports
* Emmpty line at bottom of file

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2019-11-22 20:52:10 +07:00