1

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/

Ibrahim Azhar Armar
  • 25,288
  • 35
  • 131
  • 207
  • Might not be relevant, but just curious, which RDBMS specifically? – BoltClock Aug 11 '10 at 08:56
  • Sorry for not Mentioning it, MySQL. – Ibrahim Azhar Armar Aug 11 '10 at 08:58
  • using images as text replacements is going to be add an extreme overhead to the site (obviously), so instead why not find a nice open source, free, or even PAID arabic font and embed it using a method such as Sifr (mikeindustries.com/blog/sifr) or a multitude of other text rendering engines. IMO is safer than using images. Yes there will be users who have flash / javascript enabled but at the end of the day if I stumble across a blog with loads of images waiting to load, I'm not hanging around! – SimonDowdles Aug 11 '10 at 11:20
  • you could check this out as an example of what i want to do, the following is a local news website, which the guy wants me to replicate it, they have just used images there, nor any font they have used, even though the font they are using is free to download and easily available it is supported by only a few software. http://www.sahilonline.net/ – Ibrahim Azhar Armar Aug 11 '10 at 12:12

4 Answers4

3

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

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • thank you for that kind suggestion Pekka, i am going with it, anyway how much Character does LONGTEXT Support? if i use it, will it have any effect on the performance? – Ibrahim Azhar Armar Aug 11 '10 at 09:04
  • there will be no utf-8 text, if I took the question correctly :) – Your Common Sense Aug 11 '10 at 09:04
  • @Ibrahim there are several types of text fields; `TEXT` can hold 65k of data. Choose a data type that will leave extra space even for very long articles, that should be fine. See http://dev.mysql.com/doc/refman/5.0/en/string-type-overview.html – Pekka Aug 11 '10 at 09:06
  • @Col you're right, I overread that bit! @Ibrahim I personally am against storing images in databases at all. See http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay for discussion. Also, with UTF-8, it should be possible to set up a workflow that doesn't require images at all. Related: http://www.ar-php.com/ – Pekka Aug 11 '10 at 09:07
  • wow, i have a lil confusion over here.. i know that BLOB converts the files into binary objects and store it. but does it means it will take a huge amount of space (filesize) ?? if that is the case then i would love to store just the path rather than BLOB.. (varchar) – Ibrahim Azhar Armar Aug 11 '10 at 09:14
  • @Ibrahim yup, storing the path is probably the best way. My recommendations above are for storing text (I misunderstood the question at first.) – Pekka Aug 11 '10 at 09:18
  • aaah, i got it pekka, your answers are one of the best. thank you :) – Ibrahim Azhar Armar Aug 11 '10 at 09:29
  • @Ibrahim you're welcome. Also, on a general note, there are so many blog engines out there - before starting your own, check out http://stackoverflow.com/questions/2370416/minimalistic-php-blogging-engine-with-focus-on-code-quality – Pekka Aug 11 '10 at 09:34
1

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.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
  • i would agree with you, i tried my best convincing him but he wouldn't agree with me on this, whatever the thing is i am being paid for what he wants. so i would have to go with his decision. – Ibrahim Azhar Armar Aug 11 '10 at 09:08
  • @Ibrahim you need no database then. Relational databases being used for ordering, filtering, calculating, grouping data, making relations, producing reports and such. All this has nothing to do with images. There is no job for the database. It will be huge overkill. store your images in the hard disk folder – Your Common Sense Aug 11 '10 at 09:17
  • @Ibrahim - You have told your client that it won't be possible to search for keywords in the title if the title is an image rather than varchar? – Mark Baker Aug 11 '10 at 09:21
  • @Col. the website i am developing is a blog, like the author will be Creating an Article(he wants it to upload it as images,) editing it (Updating the Images), and deleting it, he wants an Admin Page for this, he wants his users to comment (he doesnt mind if the comments made are in English), he wants to put up his custom advertisement, and manage it from admin page. basically it replicates Wordpress like features with minimal features, do you still think i can do it without the need of database? – Ibrahim Azhar Armar Aug 11 '10 at 09:23
  • @Ibrahim sure, for everything you mentioned beside blog itself. For the comments it's ok. But Admin Page is not a synonym for the database. Storing images in the database would be overkill – Your Common Sense Aug 11 '10 at 09:38
  • @everyone, using images as text replacements is going to be add an extreme overhead to the site (obviously), so instead why not find a nice open source, free, or even PAID arabic font and embed it using a method such as Sifr (http://www.mikeindustries.com/blog/sifr) or a multitude of other text rendering engines. IMO is safer than using images. Yes there will be users who have flash / javascript enabled but at the end of the day if I stumble across a blog with loads of images waiting to load, I'm not hanging around! – SimonDowdles Aug 11 '10 at 10:27
  • @webfac good point but you'd better comment it under the OP. here is only me who will notice it. – Your Common Sense Aug 11 '10 at 10:59
  • @COl. Shrapnel lol good point on my good point, moving it on up under the OP – SimonDowdles Aug 11 '10 at 11:21
0

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

Am1rr3zA
  • 7,115
  • 18
  • 83
  • 125
0

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.

Ashay
  • 675
  • 4
  • 13
  • Here you can try this editor with Arabic plug-in http://www.ar-php.org/tinymce_php_arabic.html I don't know Arabic at all. But yes you can check this & let me know is it working or not. – Ashay Aug 11 '10 at 11:35