开发者

BLOB over varchar?

开发者 https://www.devze.com 2023-01-11 05:55 出处:网络
I am developing a blog, where my client wants to use lot of images, for(articles, titles, advertisement, etc.). he hardly wants any text there, as the blog he wants it to be developed in arabic and he

I am developing a blog, where my client wants to use lot of images, for(articles, titles, advertisement, etc.). he hardly wants any text there, as the blog he wants it to be developed in arabic and he is not happy with any of the supporting font by web browser, nor he wants to adopt the EOT, he will be updating the blog daily (like just uploading the pictures),

what data type do you think i should be using for it? BLOB or VARCHAR ?

PS: i am using MySQL..

Check out the following site which uses the same concept as of my clients, although they are rivals, they have used images for links, news or advertisements and still the site is not that heavy..

http://开发者_开发知识库www.sahilonline.net/


Update: I misunderstood that you want to store the text as images. The recommendations below are for storing native text, not image data. I have to agree with @Col that this is a very bad idea - performance-wise, in regards to search engine visibility (no indexing will take place), accessibility for people with visual or other impairments, different screen resolutions, mobile devices... Although I can understand that the selection of browser-available fonts does arabic characters even less justice than they do ours, I would try and get the client away from this idea.

For new projects, definitely VARCHAR or TEXT / LONGTEXT with a UTF-8 character set.

The main reason being that only (VAR)CHAR and TEXT can do fulltext search

How you store your data in the data base has nothing to do with arabic font support or encoding issues. A UTF-8 table can store arabic text without problems.

For some very thorough basic reading on encoding issues, there's Joel Spolsky's famous Unicode article.

mySQL 5 String type overview


Blob stands for "Binary Object" while varchar stands for "variable number of characters", so, the answer is obvious, in my opinion

Though I cannot keep myself from commenting: keeping a blog post title as an image in the database is the most ridiculous solution I have ever seen in my life.


you can save your Image or other Blob object in directory hierarchy and just save the file address in database then you can use Varchar or Text for your field!

I suggest use this method other than save blob object


It will be better if you use blob. As it stores the data in format what you have inserted & displays as it is. also VARCHAR have some limit.

Please do not go for text as you are saying that "hardly wants any text there". It will be better to store Images & any Unicode formatted text in the data type blob.

Just take care of editor that you will be giving to the client for inputting the data, which should support Arabic. Plug-ins for those are available.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号