mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Add image sizing support
Add image sizing support by allowing the following options: #[width]x[height] #[width]x #x[height]
This commit is contained in:

committed by
GitHub

parent
93a3b610d6
commit
67126e85ef
@ -1379,9 +1379,10 @@ class Parsedown
|
||||
);
|
||||
|
||||
//get width and height from href attribute if exists (ex: "http://www.example.com/image.png#100x100")
|
||||
if (preg_match('/^(.*)#(\d+)x(\d+)$/', $Link['element']['attributes']['href'], $matches)) {
|
||||
if (preg_match('/^(.*)#(\d*)x(\d*)$/', $Link['element']['attributes']['href'], $matches)) {
|
||||
if(isset($matches[2])) $Inline['element']['attributes']['width'] = $matches[2];
|
||||
if(isset($matches[3])) $Inline['element']['attributes']['height'] = $matches[3];
|
||||
$Inline['element']['attributes']['src'] = $matches[1];
|
||||
}
|
||||
|
||||
$Inline['element']['attributes'] += $Link['element']['attributes'];
|
||||
|
Reference in New Issue
Block a user