Differential D12809 Diff 30828 src/applications/files/transform/PhabricatorFileThumbnailTransform.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/transform/PhabricatorFileThumbnailTransform.php
| Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | public function applyTransform(PhabricatorFile $file) { | ||||
| if ($y === null) { | if ($y === null) { | ||||
| return $xformer->executePreviewTransform($file, $x); | return $xformer->executePreviewTransform($file, $x); | ||||
| } else { | } else { | ||||
| return $xformer->executeThumbTransform($file, $x, $y); | return $xformer->executeThumbTransform($file, $x, $y); | ||||
| } | } | ||||
| } | } | ||||
| public function getDefaultTransform(PhabricatorFile $file) { | |||||
| $x = (int)$this->dstX; | |||||
| $y = (int)$this->dstY; | |||||
| $name = 'image-'.$x.'x'.nonempty($y, $x).'.png'; | |||||
| $params = array( | |||||
| 'name' => $name, | |||||
| 'canCDN' => true, | |||||
| ); | |||||
| $root = dirname(phutil_get_library_root('phabricator')); | |||||
| $data = Filesystem::readFile($root.'/resources/builtin/'.$name); | |||||
| return PhabricatorFile::newFromFileData($data, $params); | |||||
| } | |||||
| } | } | ||||