Skip to content
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

Closed
wants to merge 1 commit into from
Closed

The bitmap preview class now takes maxX and maxY into consideration #13635

wants to merge 1 commit into from

Conversation

oparoz
Copy link
Contributor

@oparoz oparoz commented Jan 23, 2015

This is a fix for #13607
and is part of the global programme to fix preview caching: #13609

  • Original TIFF: 140MB. Waiting an insane amount of time every time you need a preview because a conversion is asked every time
  • With Introducing the maximum size preview #13674: Preview only resizes a 48MB file. Waiting about a minute for each preview
  • Combined with this: Preview only resizes a 6.7MB file. Waiting about 3 SECONDS.

@MorrisJobke MorrisJobke modified the milestones: 8.0-current, 8.1-next Jan 24, 2015
@oparoz oparoz self-assigned this Jan 26, 2015
@LukasReschke LukasReschke changed the title The bitmap preview class now takes maxX and maxY into consideration [WIP] The bitmap preview class now takes maxX and maxY into consideration Feb 24, 2015
@oparoz oparoz changed the title [WIP] The bitmap preview class now takes maxX and maxY into consideration The bitmap preview class now takes maxX and maxY into consideration Feb 24, 2015
@oparoz
Copy link
Contributor Author

oparoz commented Mar 6, 2015

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.
A "fill" option could be implemented at a later stage when and if the interface changes and if it is deemed useful to received images which are of a predefined dimension such as 200x200

@@ -8,30 +10,93 @@

namespace OC\Preview;

use Imagick;
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MorrisJobke
Copy link
Contributor

@MorrisJobke
Copy link
Contributor

Works 👍 20s down to 2s with this image: https://commons.wikimedia.org/wiki/File:Allen_Ludden_Stumpers_1976.tiff

@MorrisJobke
Copy link
Contributor

code looks good

@MorrisJobke
Copy link
Contributor

@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);
Copy link
Contributor

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 ;)

@MorrisJobke
Copy link
Contributor

@owncloud-bot retest this please

@MorrisJobke
Copy link
Contributor

00:15:07.970 1) OC\Core\Avatar\AvatarControllerTest::testPostAvatarFile
00:15:07.973 file_put_contents(/dev/shm/data-autotest5/eiyadirgdeao/cache/avatar_upload): failed to open stream: No such file or directory
00:15:07.973 
00:15:07.973 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/storage/local.php:165
00:15:07.973 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:956
00:15:07.973 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:517
00:15:07.973 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/tests/core/avatar/avatarcontrollertest.php:248
00:15:07.973 
00:15:07.973 2) OC\Core\Avatar\AvatarControllerTest::testPostAvatarFileGif
00:15:07.973 file_put_contents(/dev/shm/data-autotest5/fkdxltjwmwhj/cache/avatar_upload): failed to open stream: No such file or directory
00:15:07.973 
00:15:07.973 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/storage/local.php:165
00:15:07.973 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:956
00:15:07.973 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/lib/private/files/view.php:517
00:15:07.973 /var/jenkins/workspace/pull-request-analyser-ng-simple@2/label/SLAVE/tests/core/avatar/avatarcontrollertest.php:288

@oparoz
Copy link
Contributor Author

oparoz commented Mar 11, 2015

@MorrisJobke - This is unrelated to this PR afaik

@MorrisJobke
Copy link
Contributor

@oparoz But it fails just on this branch ;)

@nickvergessen
Copy link
Contributor

Nop #14813

@MorrisJobke
Copy link
Contributor

I know.

/**
* {@inheritDoc}
*/
public function getThumbnail($path, $maxX, $maxY, $scalingup, $fileview) {
$this->maxDims = [$maxX, $maxY];
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

This is a fix for #13607 and is part of the global programme: #13609

The image aspect ratio is kept intact.
@scrutinizer-notifier
Copy link

A new inspection was created.

@oparoz
Copy link
Contributor Author

oparoz commented Mar 31, 2015

Had forgotten to rebase...

@oparoz
Copy link
Contributor Author

oparoz commented Apr 1, 2015

Weird... the "Passed" test result went away...
The same PR here #15349 was OK.
Should I just forget this one and restore the other one?

@oparoz
Copy link
Contributor Author

oparoz commented Apr 1, 2015

Moved to #15349

@oparoz oparoz closed this Apr 1, 2015
@MorrisJobke MorrisJobke removed this from the 8.1-current milestone Apr 1, 2015
@oparoz oparoz deleted the limit-bitmap-previews branch April 1, 2015 13:20
@lock lock bot locked as resolved and limited conversation to collaborators Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants