Of course the picture exists in that js file, so I opened it, then browsed it and found the following sentence:
var flash = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAA......'
(Xiaobai) <SPAN style="FONT-SIZE: small">This is the first time I realize the use of base64. I remember that when I saved web pages in the past, I always used to saving them in .mht format, because this will save the pictures in the web pages, but I have always wondered why there is only one</SPAN>
view sourceprint?<SPAN style="FONT-SIZE: small"> .mht files, but there are pictures when they are opened. Now, when you know that you save it in mht format, you convert all the pictures on the web page into base64 strings and store them in it. </SPAN>
view sourceprint?<SPAN style="FONT-SIZE: small"> </SPAN><SPAN style="FONT-SIZE: small">Implementation:</SPAN>
view sourceprint?<SPAN style="FONT-SIZE: small"><IMG src="/img/1971ruru/201003/"></SPAN>
In fact, it is very simple. When converting the image file to Base64String, you only need a ToBase64String method in the Convert class.
Image fromImage = ( );
MemoryStream stream = new MemoryStream();
( stream, imgFormat[extension] );
= Convert.ToBase64String( () );
Here I would like to add that the icon file seems to be unable to be converted (the result of my own experiment). If you need to convert the icon, you need to make some changes and save the country in a curve~
To extract the image from Base64String, the Convert.FromBase64String() method is required.
MemoryStream stream = new MemoryStream( Convert.FromBase64String( ) );
bitmap img = new Bitmap( stream );
( );
( "Completed!" );
It seems that some comrades have problems when converting back, and they feel that it should be a problem when defining the stream. When new, they directly give the converted byte[], and there should be no error of "out of the expected range". The conversion problem should have nothing to do with the original image being generated in Java or other languages. Because base64 encoding should be the same.
Author: Mr. Yixiu
Source:
var flash = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAA......'
(Xiaobai) <SPAN style="FONT-SIZE: small">This is the first time I realize the use of base64. I remember that when I saved web pages in the past, I always used to saving them in .mht format, because this will save the pictures in the web pages, but I have always wondered why there is only one</SPAN>
view sourceprint?<SPAN style="FONT-SIZE: small"> .mht files, but there are pictures when they are opened. Now, when you know that you save it in mht format, you convert all the pictures on the web page into base64 strings and store them in it. </SPAN>
view sourceprint?<SPAN style="FONT-SIZE: small"> </SPAN><SPAN style="FONT-SIZE: small">Implementation:</SPAN>
view sourceprint?<SPAN style="FONT-SIZE: small"><IMG src="/img/1971ruru/201003/"></SPAN>
In fact, it is very simple. When converting the image file to Base64String, you only need a ToBase64String method in the Convert class.
Copy the codeThe code is as follows:
Image fromImage = ( );
MemoryStream stream = new MemoryStream();
( stream, imgFormat[extension] );
= Convert.ToBase64String( () );
Here I would like to add that the icon file seems to be unable to be converted (the result of my own experiment). If you need to convert the icon, you need to make some changes and save the country in a curve~
To extract the image from Base64String, the Convert.FromBase64String() method is required.
Copy the codeThe code is as follows:
MemoryStream stream = new MemoryStream( Convert.FromBase64String( ) );
bitmap img = new Bitmap( stream );
( );
( "Completed!" );
It seems that some comrades have problems when converting back, and they feel that it should be a problem when defining the stream. When new, they directly give the converted byte[], and there should be no error of "out of the expected range". The conversion problem should have nothing to do with the original image being generated in Java or other languages. Because base64 encoding should be the same.
Author: Mr. Yixiu
Source: