-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
The bitmap preview class now takes maxX and maxY into consideration #13635
Conversation
The idea behind a "max" preview is to have the same image, including aspect ratio, that fits into max dimensions, so I've removed the "fill" action. |
@@ -8,30 +10,93 @@ | |||
|
|||
namespace OC\Preview; | |||
|
|||
use Imagick; |
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.
@DeepDiver1975 @LukasReschke Can we rely on this? is this a hard dependency already?
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.
Check is in preview:
https://github.com/owncloud/core/blob/master/lib/private/preview.php#L767
I will test this with following image: https://commons.wikimedia.org/wiki/File:Aerial_view_washington_monument_with_scaffolding.tif |
Works 👍 20s down to 2s with this image: https://commons.wikimedia.org/wiki/File:Allen_Ludden_Stumpers_1976.tiff |
code looks good |
@nickvergessen @georgehrke Interested in reviewing? |
} catch (\Exception $e) { | ||
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR); | ||
\OC_Log::write('core', 'ImageMagick says : ' . $e->getmessage(), \OC_Log::ERROR); |
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.
No space before :
, we are not french ;)
@owncloud-bot retest this please |
|
@MorrisJobke - This is unrelated to this PR afaik |
@oparoz But it fails just on this branch ;) |
Nop #14813 |
I know. |
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) { | ||
$this->maxDims = [$maxX, $maxY]; |
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.
pass this to getResizedPreview instead of saving it in the class.
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.
Is there a particular reason? I originally had 3 private methods, all needing that information and I didn't want to have to make the variables traverse each method.
Now with 2, it's less of a hassle, but I'm wondering what the issue is with leaving it as is.
EDIT: If it's to improve readability (currently the resize method has no size arguments), then I fully understand.
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.
The max dimensions is not part of the preview provider but determined by thr getThumbnail call, thus they should not be part of the state of the provider
A new inspection was created. |
Had forgotten to rebase... |
Weird... the "Passed" test result went away... |
Moved to #15349 |
This is a fix for #13607
and is part of the global programme to fix preview caching: #13609