eduardokum / laravel-mail-auto-embed

MIT License
166 stars 36 forks source link

Other attributes must follow url attribute #15

Closed EcoFreak closed 4 years ago

EcoFreak commented 5 years ago

Hello,

First things first... this helped me out greatly 👍 Initially I was struggling with the image size in Outlook and after some digging I discover that the expression used in preg_replace_callback function call only takes into account (in the regex match group) attributes that are defined after the src attribute.

$html_body = preg_replace_callback('/<img.*src="(.*?)"\s?(.*)?>/', [$this, 'replaceCallback'], $html_body);

This is really not a huge problem but I still wasted some time find this out so I would suggest either one of two things:

  1. Change the regex to include attributes both before and after the src attribute;
  2. Update the docs to include this notice.

I wouldn't mind helping if you would like me to. Thoughts?

Thanks

H

roelofr commented 4 years ago

I encountered this too, so I fixed it in #18

roelofr commented 4 years ago

As #18 has been merged, this is no longer a problem on dev-master.

A tag should at some point appear, I guess.

eduardokum commented 4 years ago

Thanks for all, i will make a new tag