I'm new to Umbraco and right now I need to find a way to save the images as a base64 string. There will be no Writing permissions on File server and I'm far from finding a viable solution.
I need to change the FileUpload component as this need to be done for every image upload available and no other file extension will ever be uploaded. A solution I found is to change the XML saved to "cmsContentXml" replacing the path to the file to "data:image/png;base64," plus the base64 code, so when its read from table it would set that as the image src, but I also couldn't find a way to do this, as I can't find any .cs file (neither in the installed version nor the Source Code I downloaded from github).
I'm using VS2010 right now, if that matters.
If I'm not providing enough information, please ask for what else you need to know.
I need to encode de images as they will have to be saved only on the database, the environment I'm setting up has a 'No file writing policy', so I can't upload the file to media folder and save the path reference on database. My deadline is already over, but I'm still working on it whenever I have time, and I think I'm pretty close to it, lets see how it goes!
I did ask about other file extensions when those specs were given and the answer was that no other file type will ever be uploaded. I do agree with you its a risk not worth taking, but I couldn't find another solution up to now.
If you want to limit the risk of any editors making any error in regards to uploading other media then images you could perhaps try to do these 2 thing
1: Remove the option to manually create a file in a folder by going to the settings section and find the folder type in the media folder and remove the checkmark from file in the structure tab
2: In the /config/umbracoSettings.config it's possible to setup file types that should be ignored if you go to the
I'm trying to make it so any file can be uploaded to database. I know the storage impact there, but as only images will be stored (and limited to that in in the umbracoSettings.config), things will go as expected and if anytime they request me to allow any file type, the damage will be reduced.
Saving image as base64
Hi,
I'm new to Umbraco and right now I need to find a way to save the images as a base64 string. There will be no Writing permissions on File server and I'm far from finding a viable solution.
I need to change the FileUpload component as this need to be done for every image upload available and no other file extension will ever be uploaded. A solution I found is to change the XML saved to "cmsContentXml" replacing the path to the file to "data:image/png;base64," plus the base64 code, so when its read from table it would set that as the image src, but I also couldn't find a way to do this, as I can't find any .cs file (neither in the installed version nor the Source Code I downloaded from github).
I'm using VS2010 right now, if that matters.
If I'm not providing enough information, please ask for what else you need to know.
Thanks a lot in advance,
Alexandre
Hi Alexandre and welcome to our :)
May I ask why you need/want to base64 encode your images?
I'm just curious and don't currently have any cues on how to ahcieve this. But I'd love to know why.
/Jan
Hey Jan, thanks for the welcome!
I need to encode de images as they will have to be saved only on the database, the environment I'm setting up has a 'No file writing policy', so I can't upload the file to media folder and save the path reference on database. My deadline is already over, but I'm still working on it whenever I have time, and I think I'm pretty close to it, lets see how it goes!
Hi Alexandre
Ok, that sounds interesting. But how about other media like pdf files, word documents etc.?
It would be ace if you would blog about it once you're done. Always nice to know about :)
/Jan
I did ask about other file extensions when those specs were given and the answer was that no other file type will ever be uploaded. I do agree with you its a risk not worth taking, but I couldn't find another solution up to now.
Hi Alexandre
If you want to limit the risk of any editors making any error in regards to uploading other media then images you could perhaps try to do these 2 thing
1: Remove the option to manually create a file in a folder by going to the settings section and find the folder type in the media folder and remove the checkmark from file in the structure tab
2: In the /config/umbracoSettings.config it's possible to setup file types that should be ignored if you go to the
Hope you find this usefull.
/Jan
I certainly did! Thanks a lot!
I'm trying to make it so any file can be uploaded to database. I know the storage impact there, but as only images will be stored (and limited to that in in the umbracoSettings.config), things will go as expected and if anytime they request me to allow any file type, the damage will be reduced.
Thanks a lot!
Hi Alexandre
Glad I could help.
Hope you will post / blog about how you did things.
Cheers, Jan
If anyone stumbles across this thread, here is my solution:
is working on a reply...