Skip to content

Commit

Permalink
trim file/caption and return autocaption based on filename if no capt…
Browse files Browse the repository at this point in the history
…ion given
  • Loading branch information
nickdekruijk committed Dec 9, 2019
1 parent cefb02f commit aa3d437
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ public function imagesParse($column = null, $index = null, $array = false)
foreach($images as $image) {
$image = explode('|', $image);
$array[] = [
'file' => $image[0],
'caption' => $image[1] ?? null,
'file' => trim($image[0]),
'caption' => trim($image[1] ?? null),
'autocaption' => trim($image[1] ?? null) ?: pathinfo($image[0])['filename'],
];
}
return $array;
Expand Down

0 comments on commit aa3d437

Please sign in to comment.