Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to give file name at base 64 images

Tags:

html

image

base64

I have following code which use image of base64, when i right click on ti and save it, it tried to save as download.gif. how can i give the name of file to download instead of having name as download.gif?

<img src="data:image/gif;base64,R0lGODlhEAAOALMAAOazToeHh0tLS/7LZv/0jvb29t/f3//Ub/
/ge8WSLf/rhf/3kdbW1mxsbP//mf///yH5BAAAAAAALAAAAAAQAA4AAARe8L1Ekyky67QZ1hLnjM5UUde0ECwLJoExKcpp
V0aCcGCmTIHEIUEqjgaORCMxIC6e0CcguWw6aFjsVMkkIr7g77ZKPJjPZqIyd7sJAgVGoEGv2xsBxqNgYPj/gAwXEQA7" 
width="16" height="14" alt="embedded folder icon">

thank you in advance.

like image 208
XML guy Avatar asked Sep 06 '11 18:09

XML guy


1 Answers

You can use link wrap with download attribute.

<a href="data:image/gif;base64,R0l...QA7" download="some_name.gif">
    <img src="data:image/gif;base64,R0l...QA7" width="16" height="14" alt="embedded folder icon"/>
</a>

Right click - save object as - this get you name in most modern browsers.

like image 88
Enyby Avatar answered Oct 17 '22 09:10

Enyby