E=mc2
asked on
Embedding a png image into an html file generated from a Powershell script
I would like to embed a png image into an html file which will then be sent as an attachment to an email.
What code would I use to embed an image such an png or jpg image into an html file?
Does the image have to be pulled externally over the internet or can it be embedded into the html as it were?
A powershell script is being used to create the html file.
What code would I use to embed an image such an png or jpg image into an html file?
Does the image have to be pulled externally over the internet or can it be embedded into the html as it were?
A powershell script is being used to create the html file.
ASKER
Thanks Katy, much appreciated.
With regards to the Base 64 encoder, is the image stored on their online database, or is it stored within the algorithm numbers?
With regards to the Base 64 encoder, is the image stored on their online database, or is it stored within the algorithm numbers?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Katy.
So the image is not saved in any way on anyone else's server?
So the image is not saved in any way on anyone else's server?
Generally no (as they delete it after converting) but if you need to guarantee this then use the PowerShell code to generate the base64 data rather than uploading to the web converter.
ASKER
Ok let me consider that then and test it.. many thanks.
To embed you'd use a tool to convert the image into Base64 e.g. Base64 Image Encoder | Online Tool (base64-encode.org) and in your HTML you'd use something like:
Open in new window
If you've just got a static image you want to use then that's probably the easiest way, otherwise if you've got different images depending on various things and want to do the base64 encoding in PowerShell you'd need something like:
Open in new window
which will output the base64 string, to insert into the code above. You'd also need to set the content type in the string accordingly.