Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Adding field to Links table

Quote Reply
Adding field to Links table
Hi, all

I'm trying to modify LinksSQL to adjust it for photos DB. So, i add field Photo MEDIUMBLOB in my Links table. Also i modify Links::User::Add->add_link - to add field 'Photo' in $input hash (i.e. $input->{'Photo'}).
Also i check that $input->{'Photo'} really gets the picture wich i do upload from add.html.
But LinksSQL doesn't insert this field in DB.

Does anybody know - why?

Thank you,
Anton.
Quote Reply
Re: [Anton_P] Adding field to Links table In reply to
Hi

how have you added the Photo field to the Links table? If you have not added it through the Links SQL admin interface, then you should go to "Database -> Links -> Properties" and click on "Resync Database".

You could also (from the admin) define a "file" field to upload your photos.

Or you could buy my upcoming "Attachment" plugin, which will allow you to easily add attachments/images to a link. As an admin you can set the maximum number of attachments, the maximal size of each attachment etc. The images can be saved privately (i.e. they can only be viewed by going through a script, and there is some access control) or publicly (i.e. the images are somewhere on your webserver where they can be read directly, to reduce server load).

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Adding field to Links table In reply to
Thank you, Ivan.

I did resync database, and now it works fine for me :)

Good luck,
Anton
Quote Reply
Re: [Anton_P] Adding field to Links table In reply to
Your welcome.

A quick question: do you know how big a photo can be (in terms of kB) for a MEDIUMBLOB field? Or in other words,how do you make sure your database is not filled up with crap by somebody?

Ivan
-----
Iyengar Yoga Resources / GT Plugins
Quote Reply
Re: [yogi] Adding field to Links table In reply to
Hm... yes, you are right.

I think about it. I did Photo type of MEDIUMBLOB - i.e. photos' size can be up to 16Mb. Of course, my DB can be filled up soon, and i think about storing pictures not in MySQL, but in files.

You say - your plugin can help me, but i have no money to pay for it, so, i'll try to do something usefull by myself. If you can advice me something usefull - it would be great.

Thank you,
Anton
Quote Reply
Re: [Anton_P] Adding field to Links table In reply to
Hi,



I do not think that storing files in a database is a good idea, even if you only have a small amount. Why don't you just store the path to where the image file is saved on your server. That way you will be able to display it just the same way as if it was saved directly in your database. When you do a DUMP (back up) you just need to save your files outside of the database as well. I am currently working on a database that has over 7000 jpgs with 7000 thumbnails and the Mysql Dump is only 3.5 mega. Off course the images take up a lot of space outside the database, but at least the database size stays low.

Just my own experience... Good luck.
Quote Reply
Re: [nt6] Adding field to Links table In reply to
Hi, nt6.

I think - you are completely right. It's not good idea. Storing paths to files? Sounds good.... and i think, i can use link ID as name for file for example...

Thank you for your suggestion!
Good luck,
Anton