Commit Graph

51 Commits

Author SHA1 Message Date
Jan-Christoph Borchardt 3259d427ee
Use correct typeface for txt previews
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
2018-10-23 13:13:21 +02:00
Roeland Jago Douma ade61d8b43
Allow the creationg of previews of files stored in appdata
To allow us to create previews of files stored in appdata we need to
construct the view differently.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-10-08 19:37:45 +02:00
Roeland Jago Douma 4758942121
Fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-08-24 21:27:21 +02:00
Sebastian Steinmetz ed15a6f2a2 HEIC previews as JPG rather than PNGs to save space.
Signed-off-by: Sebastian Steinmetz <me@sebastiansteinmetz.ch>
2018-08-24 08:58:28 +02:00
Morris Jobke bb2336f389
Merge pull request #10526 from steiny2k/HEICHEIF
Support HEIC for previews
2018-08-22 13:41:19 +02:00
Roeland Jago Douma 5b103744c8
Check if a preview provider is available before using it
Else if a preview provider is registerd but not available (for example
missing support in some external lib). It will do 💥. This way the
providers can at least do the sanity checks required.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-08-17 20:51:35 +02:00
Sebastian Steinmetz 5a996b5f87 Address comments from @rullzer:
- implement isAvailable
 - run tests only if ImageMagick with HEIC support is available in the
   environment

Signed-off-by: Sebastian Steinmetz <me@sebastiansteinmetz.ch>
2018-08-17 18:37:23 +02:00
Sebastian Steinmetz 6973b82e20 Develop HEIC/HEIF preview support #7406
Signed-off-by: Sebastian Steinmetz <me@sebastiansteinmetz.ch>
2018-08-11 00:13:43 +02:00
Tor Lillqvist 37c8ed4b5c No need to convert to PDF with LibreOffice, just convert to PNG
Exporting all pages of a document to a PDF is a waste of time. All we
need is a thumbnail of the first page anyway. Plus, reading that PDF
(even just the first page of it) into imagick is presumably much
slower than reading a simple PNG.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
2018-07-12 11:40:41 +03:00
Morris Jobke d4692d1fbe
Log path of file that failed to be parsed
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-06-28 11:09:50 +02:00
Roeland Jago Douma 14acded171
Make sure the file is readable before attempting to create a preview
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-05-30 11:34:02 +02:00
Roeland Jago Douma 39bb9c06d1
Delete the previews when a version is restored
Fixes #9469

When a version of a file is restored the previews are no longer valid.
Thus we should remove them so they are regenerated.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-05-14 19:58:19 +02:00
Roeland Jago Douma 047cf5de07
Move to join
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-05-14 13:30:22 +02:00
Roeland Jago Douma 3e07c4f73a
Kill the dete preview watcher
This code had the potential to time out. If a huge folder with pictures
for example was deleted then this could easily grow the number of files
to clean with a factor 5 (or more).

Now the previews just get cleaned up in the background. Which is good
enough for the 99% case

As a bonus this now also keeps the previews when in the trashbin so you
don't have a spiking server load when a user opens the trashbin view.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-05-14 13:30:06 +02:00
Roeland Jago Douma 3bfa031f38
Add backgroundcleanup job
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-05-14 13:25:55 +02:00
Arthur Schiwon 38a90130ce
move log constants to ILogger
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
2018-04-26 10:45:52 +02:00
Morris Jobke a661f043e1
Remove unneeded semicolon and parentheses
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-26 23:46:40 +01:00
Morris Jobke 2a38605545
Properly log the full exception instead of only the message
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-23 10:57:21 +01:00
Roeland Jago Douma 8703df3233
If the preview is size 0 it is invalid
* delete it
* throw a NotFound Exception
  - This should a proper 404 to the user
  - Next time it is then regenerated

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-22 13:57:00 +01:00
Morris Jobke 3d4c698f44
Improve OC_Image code to not guess the type of input, but actually request the specific methods to be called
Followup to #7836

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-18 13:40:55 +01:00
Morris Jobke e4b3ee8d8f
Fix float/integer handling in image API
* IImage::crop/preciseResize now have type hinting for integers
* found while testing strict typing for PHP 7+

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2018-01-17 10:00:33 +01:00
Jan-Christoph Borchardt 9386b07ed8
Merge pull request #7731 from nextcloud/preview_size_inc
Max preview size to 4096x4096
2018-01-09 11:07:02 +01:00
Roeland Jago Douma e2352cc06f
Max preview size to 4096x4096
With HiDPI screens. And even normal HD screens you want more detail from
your pictures. Or the ability to somewhat zoom on you previews. For this
we need somewhat larger previews.

Moving the default to 4096x4096 is a step up. Users that want the old
behavior can still set the values in config.php

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-08 15:35:55 +01:00
Roeland Jago Douma faa68b28cb
Only return 1 type
Throw proper exception if we can't get the mimetype for a preview. Catch
it later on so we can just return a not found for the preview.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-07 14:36:37 +01:00
Roeland Jago Douma 5b21650097
Don't lie about the preview mimetype
For legacy reasons we stored all the previews with a png extention.
However we did not put png data in them all the time.

This caused the preview endpoints to always report that a preview is a
png file. Which was a lie.

Since we abstract away from the storage etc in the previewmanager. There
is no need anymore to store them as .png files and instead we can use
the actual file extention.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2018-01-07 11:41:54 +01:00
Roeland Jago Douma 53400a1972
Properly detect if fopen fails for txt previews
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-12-11 20:37:18 +01:00
Morris Jobke 31c5c2a592
Change @georgehrke's email
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 20:38:59 +01:00
Morris Jobke 0eebff152a
Update license headers
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-11-06 16:56:19 +01:00
Roeland Jago Douma 29fb315ffc
Allow requesting the max preview
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-09-25 16:18:48 +02:00
Morris Jobke c27498db71 Use IConfig instead of static OCP\Config
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-07-27 13:43:18 +02:00
Lukas Reschke 63676d3b24 Merge pull request #5836 from nextcloud/preview_update
Empty search no longer works
2017-07-25 17:08:31 +02:00
Roeland Jago Douma 5f227bd93b
More phpstorm inspection fixes
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-07-24 11:39:29 +02:00
Roeland Jago Douma 8bee9cf8d3
Empty search no longer works
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-07-24 10:56:21 +02:00
Morris Jobke 6aac094091
Add PHPDoc
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
2017-05-02 13:43:47 +02:00
Robin Appelman 4dfd90abc4
better handling of preview generation errors
Signed-off-by: Robin Appelman <robin@icewind.nl>
2017-05-02 13:43:47 +02:00
Roeland Jago Douma 0ad4b89d41
Some code cleanup
As suggested by the inspector

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-19 20:30:46 +01:00
Roeland Jago Douma 4cd13e7668
Don't generate max preview twice
If you request a preview of X by Y. And after calculating X and Y are
equal to maxWidth and maxHeight then there is no reason to create a
preview of that size.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-19 20:23:23 +01:00
Roeland Jago Douma 53640bbc47
MP3 without cover don't get a preview
* Fixes #2739

It tries to create an image from an SVG file. Which we don't support. So
this fails and prints an log line. Then we fall back anyways to the 404
and fetch the default icon.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2017-03-10 08:52:23 +01:00
Roeland Jago Douma dab87ef6fd
Fix previews for federated shares
The owner of a federated file is the federated user. For which we
obviously can't setup a view.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-24 13:20:51 +01:00
Roeland Jago Douma 99ada40df4
Dispatch event on preview request
Fixes: #73

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-10 14:28:09 +01:00
Roeland Jago Douma 87855aa97b
Added genertor helper & tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Roeland Jago Douma d720a2fb57
Moved over files_versions
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Roeland Jago Douma 5466fbf761
Move Ipreview to more of DI thingy
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Roeland Jago Douma 8468212386
Fix name conflict
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Roeland Jago Douma d6f1287ae6
Move file
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Roeland Jago Douma c8ff9fb00e
Watch for file modification/deletion
* Only connect the watcher once the instance is properly setup else
AppData fails hard.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2016-11-03 14:00:33 +01:00
Joas Schilling 0215b004da
Update with robin 2016-07-21 18:13:58 +02:00
Joas Schilling ba87db3fcc
Fix others 2016-07-21 18:13:57 +02:00
Hendrik Leppelsack 11be3d6276 remove png references in core 2016-07-01 16:36:37 +02:00
Lukas Reschke aba539703c
Update license headers 2016-05-26 19:57:24 +02:00