Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/markup/PhabricatorImageRemarkupRule.php
| Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | public function didMarkupText() { | ||||
| } | } | ||||
| foreach ($images as $image) { | foreach ($images as $image) { | ||||
| $args = $image['args']; | $args = $image['args']; | ||||
| $src_uri = id(new PhutilURI('/file/imageproxy/')) | $src_uri = id(new PhutilURI('/file/imageproxy/')) | ||||
| ->setQueryParam('uri', $args['uri']); | ->setQueryParam('uri', $args['uri']); | ||||
| $img = $this->newTag( | $img = id(new PHUIRemarkupImageView()) | ||||
| 'img', | ->setURI($src_uri) | ||||
| array( | ->setAlt($args['alt']) | ||||
| 'src' => $src_uri, | ->setWidth($args['width']) | ||||
| 'alt' => $args['alt'], | ->setHeight($args['height']); | ||||
| 'width' => $args['width'], | |||||
| 'height' => $args['height'], | |||||
| )); | |||||
| $engine->overwriteStoredText($image['token'], $img); | $engine->overwriteStoredText($image['token'], $img); | ||||
| } | } | ||||
| } | } | ||||
| private function isURI($uri_string) { | private function isURI($uri_string) { | ||||
| // Very simple check to make sure it starts with either http or https. | // Very simple check to make sure it starts with either http or https. | ||||
| // If it does, we'll try to treat it like a valid URI | // If it does, we'll try to treat it like a valid URI | ||||
| return preg_match('~^https?\:\/\/.*\z~i', $uri_string); | return preg_match('~^https?\:\/\/.*\z~i', $uri_string); | ||||
| } | } | ||||
| } | } | ||||