Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php
| Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | final class PhabricatorEmbedFileRemarkupRule | ||||
| private function renderImageFile( | private function renderImageFile( | ||||
| PhabricatorFile $file, | PhabricatorFile $file, | ||||
| PhabricatorObjectHandle $handle, | PhabricatorObjectHandle $handle, | ||||
| array $options) { | array $options) { | ||||
| require_celerity_resource('lightbox-attachment-css'); | require_celerity_resource('lightbox-attachment-css'); | ||||
| $attrs = array(); | $attrs = array(); | ||||
| $image_class = null; | $image_class = 'phabricator-remarkup-embed-image'; | ||||
| $use_size = true; | $use_size = true; | ||||
| if (!$options['size']) { | if (!$options['size']) { | ||||
| $width = $this->parseDimension($options['width']); | $width = $this->parseDimension($options['width']); | ||||
| $height = $this->parseDimension($options['height']); | $height = $this->parseDimension($options['height']); | ||||
| if ($width || $height) { | if ($width || $height) { | ||||
| $use_size = false; | $use_size = false; | ||||
| $attrs += array( | $attrs += array( | ||||
| Show All 21 Lines | if ($use_size) { | ||||
| $attrs['src'] = $file->getURIForTransform($xform); | $attrs['src'] = $file->getURIForTransform($xform); | ||||
| $dimensions = $xform->getTransformedDimensions($file); | $dimensions = $xform->getTransformedDimensions($file); | ||||
| if ($dimensions) { | if ($dimensions) { | ||||
| list($x, $y) = $dimensions; | list($x, $y) = $dimensions; | ||||
| $attrs['width'] = $x; | $attrs['width'] = $x; | ||||
| $attrs['height'] = $y; | $attrs['height'] = $y; | ||||
| } | } | ||||
| $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 105 Lines • Show Last 20 Lines | |||||