Owl\Libraries\CustomMarkdown::parseImage PHP Method

parseImage() protected method

@Override
protected parseImage ( $markdown )
    protected function parseImage($markdown)
    {
        if (($parts = $this->parseLinkOrImage(substr($markdown, 1))) !== false) {
            // if $parts'count over 6, it shows that markdown formats is wrong.
            if (count($parts) < 6) {
                // remove all starting [ markers to avoid next one to be parsed as link
                $result = '!';
                $i = 1;
                while (isset($markdown[$i]) && $markdown[$i] == '[') {
                    $result .= '[';
                    $i++;
                }
                return [['text', $result], $i];
            }
            list($text, $url, $title, $offset, $key, $height, $width) = $parts;
            return [['image', 'text' => $text, 'url' => $url, 'title' => $title, 'refkey' => $key, 'height' => $height, 'width' => $width, 'orig' => substr($markdown, 0, $offset + 1)], $offset + 1];
        } else {
            // remove all starting [ markers to avoid next one to be parsed as link
            $result = '!';
            $i = 1;
            while (isset($markdown[$i]) && $markdown[$i] == '[') {
                $result .= '[';
                $i++;
            }
            return [['text', $result], $i];
        }
    }