Reputation: 2174
it is my first experience with DB and therefore I'm kinda lost since I do not know much about it, so please go easy on me.
I am creating a table in MySQL where one of the columns will hold full path URLs to the images (one per line) like the following http://cdn.example.com/images/image1.png
My question is, what type should I give to this column, what MIME type, what Browser transformation and at last Transformation options?
So what I am trying to achieve is, when image is requested it should create the following
<img src="http://cdn.example.com/images/image1.png" width="150" Height="200" alt="Image Title">
I am also planning on creating another column for image width, image height and for alt.
can you please help me
Thanks in advance
Upvotes: 0
Views: 364
Reputation: 126
Depends on the length of the URL you'll be holding but I'd use varchar(255)
for the column type.
I've never had to worry about the MIME types. 99.999% of the time you will ignore them and just leave them empty.
Hope this helps you
Upvotes: 2
Reputation: 1741
You can also use TEXT instead of varchar and not worry about the length restriction of varchar
remember to enforce length restriction at your application program level rather than at the db level .. e.g. dont allow URLs larger than 500 characters
VARCHAR access is faster than TEXT ... so depending on performance requirement you may have to make a trade-off here
Upvotes: 0
Reputation: 2452
if you are storing just the url and not the full tag varchar 255 should be enough. If you trim out the extra http:// , you save 7 characters
Upvotes: 0