Improve image thumbnailing and increase the size of Macro thumbnails
Summary:
Alternate proposal for D3635.
- Works better with small images.
- Produces a predictable thumbnail size.
- Somewhat reasonable output on 3000x10 images.
- Increase the size of Macro thumbnails to 240px.
Test Plan: {F20497}
Reviewers: vrana, chad
Reviewed By: vrana
CC: aran
Differential Revision: https://secure.phabricator.com/D3638
This commit is contained in:
@@ -55,6 +55,12 @@ final class PhabricatorFileTransformController
|
||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||
|
||||
switch ($this->transform) {
|
||||
case 'thumb-220x165':
|
||||
$xformed_file = $this->executeThumbTransform($file, 220, 165);
|
||||
break;
|
||||
case 'preview-220':
|
||||
$xformed_file = $this->executePreviewTransform($file, 220);
|
||||
break;
|
||||
case 'thumb-160x120':
|
||||
$xformed_file = $this->executeThumbTransform($file, 160, 120);
|
||||
break;
|
||||
@@ -133,6 +139,11 @@ final class PhabricatorFileTransformController
|
||||
return id(new AphrontRedirectResponse())->setURI($uri);
|
||||
}
|
||||
|
||||
private function executePreviewTransform(PhabricatorFile $file, $size) {
|
||||
$xformer = new PhabricatorImageTransformer();
|
||||
return $xformer->executePreviewTransform($file, $size);
|
||||
}
|
||||
|
||||
private function executeThumbTransform(PhabricatorFile $file, $x, $y) {
|
||||
$xformer = new PhabricatorImageTransformer();
|
||||
return $xformer->executeThumbTransform($file, $x, $y);
|
||||
|
||||
Reference in New Issue
Block a user