| Conditions | 4 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 34 | protected function inlineImage($excerpt) |
||
| 35 | { |
||
| 36 | $image = parent::inlineImage($excerpt); |
||
| 37 | |||
| 38 | if (!isset($image)) { |
||
| 39 | return null; |
||
| 40 | } |
||
| 41 | |||
| 42 | $query = parse_url($image['element']['attributes']['src'], PHP_URL_QUERY); |
||
| 43 | if ($query === null) { |
||
| 44 | return $image; |
||
| 45 | } |
||
| 46 | // clean URL |
||
| 47 | $image['element']['attributes']['src'] = strtok($image['element']['attributes']['src'], '?'); |
||
| 48 | |||
| 49 | // has resize value |
||
| 50 | parse_str($query, $result); |
||
| 51 | if (array_key_exists('resize', $result)) { |
||
| 52 | $size = (int) $result['resize']; |
||
| 53 | $image['element']['attributes']['width'] = $size; |
||
| 54 | |||
| 55 | $image['element']['attributes']['src'] = (new Image($this->builder)) |
||
| 56 | ->resize($image['element']['attributes']['src'], $size); |
||
| 57 | } |
||
| 58 | |||
| 59 | return $image; |
||
| 60 | } |
||
| 62 |