LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Embedding GIF into HTML? (https://www.linuxquestions.org/questions/linux-software-2/embedding-gif-into-html-619085/)

waelaltaqi 02-06-2008 07:59 AM

Embedding GIF into HTML?
 
How do i embed pictures into HTML? I have a cron job that sends an HTML file and I'm using
Code:

<img src="http://mysite/picture.gif">
to include a picture in the email.

The problem is that when the user recives the email, Thunderbird or outlook will ask whether to download the the picture from the site or not. The picture contains my companies logo and i would like it to show up the moment the user opens the email.

I've seen it done before I've seen some articles about embedding GIF using base64 encoding but i have no clue how to do that...

Anyone can help?

acid_kewpie 02-06-2008 08:10 AM

that's really none of your business, it's the client taking measures to protect the user irrespective of the file. you shouldn't be able to influence that at all, or that would totally destroy the security measures in the first place.

pixellany 02-06-2008 08:26 AM

((especially important with GIFs since they are a way of embedding malicious code))

Much better to use words and include a link to a website.

acid_kewpie 02-06-2008 08:40 AM

http://www.text-image.com/ ;)

Nathanael 02-06-2008 09:45 AM

attach the image (base64 encoded) with
Content-ID: <image01.png@FFFFFFFF.FFFFFFFF>
in the html part, reference as source of the image the Content-ID like so: "cid:image01.png@01C8584B.D9F65490"
that will then point to the attachment rather than an external image

i would personally use a png rather than a gif!

@moderators: remove this if you find it inappropriate, as i am sure you would anyway :-)

acid_kewpie 02-06-2008 09:49 AM

but surely any client would block that in exactly the same way..? if it's malicious it's just as malicious there, no?

Nathanael 02-06-2008 09:59 AM

it does not look like the clients block the displaying of attached images, but of course it's slightly ugly, as it increases the email size, and also all your emails have an attachment.
i also am not sure what happnes if you simply have a div and add a background image with css to that, would be worth a try.

waelaltaqi 02-07-2008 10:35 AM

I got half of the problem resolved. I was able to convert my companies logo using uuencode then embed it into HTML using base64 encoding. Part of my code looks like this:

Code:

<img src="data:image/gif;base64,R0lGODlh0wFvAOf+AAABBg0PDBIUERYYFhobGR4gHQQc .. >
I get the picture to show up fine with Firefox but not with IE. Now since IE can't then Outlook won't open it either. I've read that IE can't read base64 type encoding without further adjustment to the code. Does using MHTML type docs need completely different code or what... Little frustrated here ... Any ideas on that part?
Thanks in advance.


All times are GMT -5. The time now is 01:46 PM.