Image to URI, an easy way to convert
Welcome all.
I read Habr for a long time, and somehow it was never mentioned that there is any easy way to convert images to data: URI.
Yes, of course there are online services for converting, but when mass conversion is required, it’s not very convenient to work with them.
So I started searching and found .
But since initially, this utility (for me the only way the language rotates) is a little inconvenient.
I started to finish this utility.
Here's what happened.
First, watch the video, immediately a lot will become clear.
HD link to YouTube
And now a little more.
There is such an archive.

In it ...

Well, that's it ...

We want to transfer this picture to data: URI.

To do this, drop it into the image2css folder and run the z_1.cmd bag.
At the output, we get a finished file with data: URI

Note:
1. You can do the bulk conversion for this in the archive there is a file z_.cmd
2. In this archive there is Notepad2, it is needed in order to show us the code, since the native Notepad terribly annoys me.
3. You can throw a file with any name into the folder, it will be automatically renamed to favicon.png.
4. If you want to encode a GIF image, all you need is for this, in the z_1.cmd filechange the extension to gif.
5. Since I’m a forgetful guy, I made an autobackup of all the conflated files.
Those.
aspng folders - stores all converted png pictures in it
; asuri - stores all converted URI text files.
And also, do not forget the utility needs installed Java.
Well, the image2css.7z utility on Yandex Disk itself.
I hope my script will help you, because I did it for myself, and I think it’s not at all beautiful not to share it with the people.
UPD 1.
So that the work of commentators is not in vain, because the article is already in the index and will help pioneers and just webmasters.
Method 1
Convert PHP using zapimir
Method 2
Converting With Linux From Stdit
Method 3
Converting windows programs from silvansky
Data URI Generator by forces
The program embeds its menu item when RMB is clicked on a css file.
And from the original css (in which links to pictures) it is generated in a separate css (data uri)
I read Habr for a long time, and somehow it was never mentioned that there is any easy way to convert images to data: URI.
Yes, of course there are online services for converting, but when mass conversion is required, it’s not very convenient to work with them.
So I started searching and found .
But since initially, this utility (for me the only way the language rotates) is a little inconvenient.
I started to finish this utility.
Here's what happened.
First, watch the video, immediately a lot will become clear.
HD link to YouTube
And now a little more.
There is such an archive.

In it ...

Well, that's it ...

We want to transfer this picture to data: URI.

To do this, drop it into the image2css folder and run the z_1.cmd bag.
At the output, we get a finished file with data: URI

Note:
1. You can do the bulk conversion for this in the archive there is a file z_.cmd
2. In this archive there is Notepad2, it is needed in order to show us the code, since the native Notepad terribly annoys me.
3. You can throw a file with any name into the folder, it will be automatically renamed to favicon.png.
4. If you want to encode a GIF image, all you need is for this, in the z_1.cmd filechange the extension to gif.
5. Since I’m a forgetful guy, I made an autobackup of all the conflated files.
Those.
aspng folders - stores all converted png pictures in it
; asuri - stores all converted URI text files.
And also, do not forget the utility needs installed Java.
Well, the image2css.7z utility on Yandex Disk itself.
I hope my script will help you, because I did it for myself, and I think it’s not at all beautiful not to share it with the people.
UPD 1.
So that the work of commentators is not in vain, because the article is already in the index and will help pioneers and just webmasters.
Method 1
Convert PHP using zapimir
url(data:{$_FILES['file']['type']};base64,
" . base64_encode(file_get_contents($_FILES['file']['tmp_name'])) . ')';
}
?>
Method 2
Converting With Linux From Stdit
$ find . -name "*.png" -exec echo {} " -> " \; -exec base64 {} \;
Method 3
Converting windows programs from silvansky
Data URI Generator by forces
The program embeds its menu item when RMB is clicked on a css file.
And from the original css (in which links to pictures) it is generated in a separate css (data uri)