Starter kit. More complicated than your original because it needs to remove spaces from the expression and provide special variables for certain constructions.
However, this probably isn’t the way you were thinking of invoking it (applying inside of current tiddler) since the current tiddler would already have the images.
<$vars myCur=<<currentTiddler>>
sp=""" """
img1="\[img\["
img2=".jpg\]\]"
>
{{ [<myCur>get[text]search-replace:gi:regexp[\n],<sp>search-replace:gi:regexp<img1>,[@1@@]split[@1]prefix[@@]search-replace:gi:regexp<img2>,[.jpg@@]split[@@]regexp[(\.jpg$)]] || LightBox }}
</$vars>