Base64

Status
Not open for further replies.

ace_case

Member
Messages
217
Reaction score
11
Points
18
I am working on a complete rewrite of my website. I am wondering if it would be better to store user submitted images as base64 in the database, or as actual files in a directory. I'm leaning towards using the base64, but how does this effect the rules on gallerys? Do user images (avatars, cover art, etc.) count towards the gallery limit, and if so, would storing them as base64 be disallowed?
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
It sounds like you've outsmarted that rule in a way. That is a really good question. :lol:
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
I'm leaning towards using the base64, but how does this effect the rules on gallerys? Do user images (avatars, cover art, etc.) count towards the gallery limit...
Re: ToS Question - From a post on 2013-04-24 by Skizzerz
File Storage refers to using your account for the storage of files that are not related to (used by) the website(s) you are running. If the files relate to your website(s) (That is they are photos/videos that are used on your site, the script files themselves, and other downloads that directly pertain to your website(s)), then they do not fall under "file storage." Certain things are still not allowed even if they are used on your site, such as anything considered illegal under US law, mirrors (hosting copies of downloads available elsewhere), and game file hosting (such as custom mods, maps, etc. that you did not directly make -- if you made the mod/map yourself and are selling it/giving it away, then that is allowed within reason -- try to keep it to a reasonable amount of disk space; keep in mind you ARE sharing the server with thousands of other users). Flash arcades do not count as file storage as long as the arcade is actually accessible on your website(s).
a image file encoded to 'base64' is still a image file - which I am sure x10hosting has a running bot looking for them - the same for any other type of image file

...would storing them as base64 be disallowed?
IMO you need to run a test if this new [ mod_security ] hammer x10hosting is now using will let you do/use 'base64' encoding of image files
 
Last edited:

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
using base64 to encode the strings has some advantages, like being "safe" since it doesn't have any control characters, quotes, etc.

However, base64 will increase the size of EACH image stored by 33%. Storing the images as BLOB is much faster and efficient with storage. The files would still count towards a personal gallery, as the database is stored on disk and counts towards your quota.
 

caftpx10

Well-Known Member
Messages
1,534
Reaction score
114
Points
63
using base64 to encode the strings has some advantages, like being "safe" since it doesn't have any control characters, quotes, etc.

However, base64 will increase the size of EACH image stored by 33%. Storing the images as BLOB is much faster and efficient with storage. The files would still count towards a personal gallery, as the database is stored on disk and counts towards your quota.
Wouldn't it be harder to get the exact size of the images if the table structure size is added on to the size holding the images as BLOB?
 

leafypiggy

Manager of Pens and Office Supplies
Staff member
Messages
3,819
Reaction score
163
Points
63
table structure, indexes, etc are negligible.

They're more or less binary data (Skizzerz, feel free to correct me there). We wouldn't be extracting the size of the images themselves, but rather I might look and see that /var/lib/mysql/user_database/pictures_table.ext is 5G.

There's probably 5G of photos in it.
 

Skizzerz

Contributors
Staff member
Contributors
Messages
2,929
Reaction score
118
Points
63
Yep, the BLOB and (VAR)BINARY types just store the raw binary data of the image (with a bit of overhead for things such as bytelength and any indexes you may have on that column). @leafypiggy hit the nail on the head for how we detect usage for things in databases -- we don't do automated scans of your db content to see if you are using more than 1GB of space on image stuff (nor would that really be feasible due to the myriad ways of storing images both in-database and outside), instead we mostly see that your account is using way more space than normal and then investigate why from there.

Hope that helps :)
 

ace_case

Member
Messages
217
Reaction score
11
Points
18
Whoops kinda forgot about posting this haha, thanks for all this info, one more question, would allowing users to upload images for their stories count towards gallery usage? Right now the user can submit their stories, but I want to know if it counts before allowing them to upload cover art for their story (for setting appropriate limits, etc.)
 

Sharky

Community Paragon
Community Support
Messages
4,399
Reaction score
94
Points
48
Stuff like cover art, unless the originals, won't take up huge amounts of space but if you want to be really cautious there are services like imgur designed for hosting images. Other services are available.
 
Status
Not open for further replies.
Top