 |
|
 |
Шеы a big surprise for me that I can't download this utility 'cause 404 error. can anybody help me? may be you can send it for me by email?
|
|
|
|
 |
|
 |
I have just tested both of the downloadable files and they both work for me.
I don't understand where the problem could be?
|
|
|
|
 |
|
 |
Works great. If there were an option to limit line-length** (64,76,custom), then it would be perfect (for my purpose, which is inserting small images in CSS for web-page usage--ratings, etc.); as it is, I just do it manually (...such a chore ).
Thanks.
**Well, that, and being able to drag&drop a file to the window.
modified on Thursday, March 19, 2009 5:17 AM
|
|
|
|
 |
|
 |
Hi,
What do you mean by limit line-length? If we said custom with line length of 3,
Instead of outputting: ====================== ABCDABCD
Output: ======= ABC DAB CD
I am glad that you have found this tool useful!
Many thanks, Lea Hayes
|
|
|
|
 |
|
 |
Correct.
The old "default" line length for MIME is 76 (which I presume is still true, though not relevant for my purpose beyond the fact that the encoding tool I've been using--an 'online' tool--does use this default) and for something else (which I don't use so don't remember) is 64. One of the editors I use doesn't have a function for wrapping the line, so when I insert base64 encoded text it extends far beyond the right margin, which also happens with several processes used just to view the code. Allowing for those processes by limiting line length to the old MIME standard of 76 is really just more of convenience factor for my usage; I only mentioned it at all on the off chance that you might be looking for another feature to add, another reason to "tinker" .
Thanks again.
|
|
|
|
 |
|
 |
Hye,
We are currently in the middle of a project. We convert the documents of an organization to xml format, and the aim of the project is to create an application and a database of these documents to be able to make reports and data searching. Now, I have to convert a document full of pictures and diagrams. The question is: is it better to convert all pictures to base64 and store them this way in the xml-file, or should I simply use a hyperlink which points to the path of the picture and I copy all of them in a single folder?
Many thanks for your answer.
Regards,
Jeno
|
|
|
|
 |
|
 |
Hi Jeno,
My personal oppinion would be to keep the image/data files seperate from your XML files for numerous reasons. If there were a lot of image/data files, you could try and find a way to group them into different folders to reduce the number of files in each folder. i.e. perhaps place all images associated with "Joe Blogs" in its own folder.
If you embeded everything into one XML file:
1 - The XML file could become extremely large and thus a LOT slower to parse. This would cause serious performance issues if you perform lots of queries and searches on your data.
2 - If the data files get changed, it is much simpler to just update the individual files as opposed to the entire XML file.
3 - If for whatever reason your XML file becomes corrupt, you could loose both the XML data and the embedded data.
Generally it is a good idea to keep data, presentation, and resources seperately.
If you wanted to combine everything into a single file I would recommend using a ZIP archive. Upon reading the archive your first port of call is the XML file which tells you what else to look for within the archive.
I hope that this is of use to you!
Please feel free to ask more questions!
Lea Hayes
|
|
|
|
 |
|
 |
Hi there. I downloaded new source of your project. But there is an Exception for converting icon files yet. :(
|
|
|
|
 |
|
 |
Hi,
I have tested the utility with converting from icons to base-64 and vice-versa.
Would it be possible for you to provide a step-by-step guide as to how I am to reproduce this error?
Also, it would be fantastic if you could send me the icon file for which you are trying to load.
Many thanks! Lea Hayes
|
|
|
|
 |
|
 |
Hey lhayes00. Please send your mail address
modified on Wednesday, September 17, 2008 7:46 AM
|
|
|
|
 |
|
 |
Hi,
Is it possible for you to temporarily host the icon file on a webserver? I didn't really want to put my email address in the forums to avoid SPAM bots.
Does the problem occur for any icon? Or just a specific one?
If it occurs for any icon, what exactly are you doing?
Sorry for the delay, Lea Hayes
|
|
|
|
 |
|
 |
Hi,
lhayes00 wrote: Is it possible for you to temporarily host the icon file on a webserver? I didn't really want to put my email address in the forums to avoid SPAM bots.
All right. Try these icons. http://www.mediafire.com/?my4duyaxluv[^]
lhayes00 wrote: Does the problem occur for any icon? Or just a specific one?
Yes, the problem occur for any icons.
lhayes00 wrote: If it occurs for any icon, what exactly are you doing?
Well, I just open it with your App.
|
|
|
|
 |
|
 |
Hi,
I have found where the problem is.
When I submitted the update for CodeProject, the .ZIP download files were for some reason the links on the page were not updated. But they have uploaded the zip files. I will let CodeProject know about this and hopefully this problem will be resolved soon.
Here are some working links to get you going: I am sorry for this mix up!!
Lea Hayes
|
|
|
|
 |
|
 |
No problem my friend. Thank you for sharing.
|
|
|
|
 |
|
 |
Thank you lhayes00 for updating
|
|
|
|
 |
|
 |
Hi there and thanks for this article. I used this method :
public string ImageToBase64String(Image image, ImageFormat format) { MemoryStream memory = new MemoryStream(); image.Save(memory, format); string base64 = Convert.ToBase64String(memory.ToArray()); memory.Close();
return base64; }
But in above line this Exception occurred.
Value cannot be null. Parameter name: encoder
Can you help me ?
|
|
|
|
 |
|
 |
Hi Mohammad,
Could you show me how you are constructing the input image, and the code which you are using to call this function. i.e.
Image myImage = ???; string result = ImageToBase64String(???, ???); This will help me to understand your problem.
Thanks, Lea Hayes
|
|
|
|
 |
|
 |
Thank you for quick response. You can see it by yourself. If you open an icon file by your App , you'll see that.
|
|
|
|
 |
|
 |
Hi,
Sorry, I didn't realize you were trying to load icon files.
Icons are a different kind of beast because they can contain a lot of additional information. When I get some spare time I will update this tool to include the icon support.
Here are two methods which I have used in the past to achieve exactly what your after: public string IconToBase64String(Icon image) { MemoryStream memory = new MemoryStream(); image.Save(memory); string base64 = Convert.ToBase64String(memory.ToArray()); memory.Close();
return base64; } public Icon IconFromBase64String(string base64) { MemoryStream memory = new MemoryStream(Convert.FromBase64String(base64)); Icon result = new Icon(memory); memory.Close();
return result; } Also, it is great to note that you can get the different icon sizes by:Icon myIcon = IconFromBase64String("..."); Icon small = new Icon(myIcon, new Size(16, 16)); Icon normal = new Icon(myIcon, new Size(32, 32)); Icon large = new Icon(myIcon, new Size(48, 48));Please note, that you must initially open the icon via something like new Icon("filename and path"); in order to get all of this additional information.
Please feel free to ask anymore question if your still having difficulties!
I hope this helps! Lea Hayes
|
|
|
|
 |
|
 |
Great, thank you Lea Hayes. A perfect response.
|
|
|
|
 |
|
 |
I have just submitted a revised version of the article to CodeProject.
The new version allows you to:
> Convert from anything to base-64. > To convert from base-64 to anything you must create your own specialized method.
> Convert from an Image to base-64. > Convert from an Icon to base-64. > Convert from a Cursor to base-64. > Convert from base-64 to an Image. > Convert from base-64 to an Icon. > Convert form base-64 to a Cursor.
Many thanks, Lea Hayes
|
|
|
|
 |
|
|
 |
|
 |
I needed to do this magic of converting binary to text for a BMP to put into my Firefox search plug-in. But the xml format worked better for me than 'opensearch' and with a .src file, so I could not get FF to just pick up my image, since the XML format already converts it. Thanks again.
Conrad - Always do badly to start off, that way when you get the hang of it suddenly, everyone is surprised.
|
|
|
|
 |