The code is not being used in the correct place.
You need to place this code in the same script as where you're sending the sendGrid email (not in the mapping function)...
Make sure the asset has been mapped to the emailPic lsv (as you've done) and then you can retrieve it in the code that you posted in the beginning of this thread.