store image in database or path which better?

There are different pros and cons of saving images file into database.

Saving Image file in Database

Pros:

If you want to save and secure sensitive/confidential Images like employee face images.
Deleting the file will delete the image too.
Database backup will automatically backup the images too.

Cons:

Slow access to the image and require more resources on the server.
The database grows quickly consequently database backup will require more time.

Saving Image  in File System


Pros:

Enable quick access to the image, Webserver easily/quickly provide the file.
Easily viewable on the server through image viewer/browse.

Cons:

Deleting the record will require to delete the file separately.
Low security of image

Ref:


  1. https://teamtreehouse.com/community/storing-image-in-database-compare-with-storing-at-the-folder-server
  2. https://www.quora.com/Difference-in-storing-image-in-database-table-vs-storing-image-in-folder-and-save-its-path-in-database-Which-is-better-and-why-PHP
  3. https://habiletechnologies.com/blog/better-saving-files-database-file-system/

How to send email form Unity3d and C# using gmail

Here are the 7 steps guide to send an email from your unity game using Gmail service. With gamil mail service you can send email in unity3d.

Steps for Gmail Account:

1. Login to Gmail Account
2. Go to at this location https://myaccount.google.com/security
3. Go to the Less secure app access section and Turn on Allow less secure app access (see image below)


Steps for Unity

4. Create a Unity project (or in your existing project) Make a script with SendEmail name and Copy Below code.
5. Attach the script with any game-object in your hierarchy.
6. Provide the credential in the inspector in the script (like your account and password and receiver account, message body, etc)
7. Run the game, it will send the email to the desired address in the start function

Note: If your system is behind a proxy then, email may not be sent and throw an exception.