Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php
Show First 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | if ($use_size) { | ||||
'src' => $file->getBestURI(), | 'src' => $file->getBestURI(), | ||||
'height' => $file->getImageHeight(), | 'height' => $file->getImageHeight(), | ||||
'width' => $file->getImageWidth(), | 'width' => $file->getImageWidth(), | ||||
); | ); | ||||
$image_class = 'phabricator-remarkup-embed-image-full'; | $image_class = 'phabricator-remarkup-embed-image-full'; | ||||
break; | break; | ||||
case 'thumb': | case 'thumb': | ||||
default: | default: | ||||
$attrs['src'] = $file->getPreview220URI(); | $preview_key = PhabricatorFileThumbnailTransform::TRANSFORM_PREVIEW; | ||||
$dimensions = | $xform = PhabricatorFileTransform::getTransformByKey($preview_key); | ||||
PhabricatorImageTransformer::getPreviewDimensions($file, 220); | $attrs['src'] = $file->getURIForTransform($xform); | ||||
$attrs['width'] = $dimensions['dx']; | |||||
$attrs['height'] = $dimensions['dy']; | $dimensions = $xform->getTransformedDimensions($file); | ||||
if ($dimensions) { | |||||
list($x, $y) = $dimensions; | |||||
$attrs['width'] = $x; | |||||
$attrs['height'] = $y; | |||||
} | |||||
$image_class = 'phabricator-remarkup-embed-image'; | $image_class = 'phabricator-remarkup-embed-image'; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (isset($options['alt'])) { | if (isset($options['alt'])) { | ||||
$attrs['alt'] = $options['alt']; | $attrs['alt'] = $options['alt']; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |