現在、CodeIgniter 3.1.3 とParsedown / Markdown Guideを使用しています
パースダウンを使用して、画像の幅と高さを設定できるようにしたいと思います
![enter image description][1]
[1]: http://www.example.com/image.png '100x200' <-- widthxheight
上記の方法を試しますが、代わりに画像のタイトルを設定します。
出力は次のようになります
<img src="http://www.example.com/image.png" width="100" height="200" alt="enter image description">
parsedown ライブラリの質問画像の幅と高さを取得および設定できるように変更する方法はありますか?
protected function inlineImage($Excerpt)
{
if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[')
{
return;
}
$Excerpt['text']= substr($Excerpt['text'], 1);
$Link = $this->inlineLink($Excerpt);
if ($Link === null)
{
return;
}
$Inline = array(
'extent' => $Link['extent'] + 1,
'element' => array(
'name' => 'img',
'attributes' => array(
'src' => $Link['element']['attributes']['href'],
'alt' => $Link['element']['text'],
'width' => '',
'height' => ''
),
),
);
$Inline['element']['attributes'] += $Link['element']['attributes'];
unset($Inline['element']['attributes']['href']);
return $Inline;
}