0

I am planning on starting a blog with articles that contain images (mostly these images will be used for explanatory purposes). The articles contents (text + images) will be stored in a MySQL database in one field in one table. My question is: is BLOB the best data type in MySQL to store these articles? I am open to table design recommendations as well.

Kidus A
  • 1
  • 2
  • Are you saying you'll store the images inside the Mysql database? – Charles Forest Feb 07 '15 at 02:05
  • I was thinking of storing the article's content (text + images) in one field in a table in the database. – Kidus A Feb 07 '15 at 02:07
  • Better store a Link to the image in your database instead of an encoded Image. There has been long discussions about it whether you should do this or not. Also check here: http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay . Since you are asking for a best practice I hope it was not to much offtopic – kentor Feb 07 '15 at 02:09
  • Images should be stored on the local filesystem, if you insist though, yeah use BLOB. – DeDee Feb 07 '15 at 02:10
  • IMHO, you shouldn't do that, what I'll do in this case is store only the path of the image in the database in form of text :) – Redaa Feb 07 '15 at 02:10
  • How exactly does one store images inside text? – deceze Feb 07 '15 at 02:10
  • @deceze Base64 encoded – kentor Feb 07 '15 at 02:11
  • @deceze for example as base64-encoded file contents, or straight binary after/between certain custom separator(s). – DeDee Feb 07 '15 at 02:11
  • So you're going to send a giant base64 blob to the client? That prevents the client from caching the images separately, which is not great. – deceze Feb 07 '15 at 02:11
  • It is indeed not great, also for multiple perspectives. I guess SEO may a topic for you as well. So for this reason you should definately using real images :). Google likes images with alt tags – kentor Feb 07 '15 at 02:13

0 Answers0