Page 1 of 1

How to approach photos and store them

PostPosted: Mon Feb 13, 2012 9:10 pm
by wisni1rr
I am wondering how I would approach storing photos in my mysql database. It should be possible to have more than one picture tied to a record.

I would like a thumbnail of the first picture to appear as the first entry in the detail list of the table.

I am new to the xataface and php/mysql.

Any help would be most appreciated!!!

Re: How to approach photos and store them

PostPosted: Tue Feb 14, 2012 11:21 am
by shannah
My recommendation would be to not store the photos in the database, but just store that name of the file. You can use a container field for this.
By "details list" do you mean you want the image to be on the "details" page or the "list" page for the table?

See http://xataface.com/documentation/how-t ... le-uploads for info on handling file uploads. It includes examples for both storing in the database and storing on the file system.

Once you have the image in the db, Xataface makes it quite easy to embed it wherever you want.

-Steve

Re: How to approach photos and store them

PostPosted: Tue Feb 14, 2012 2:25 pm
by wisni1rr
Thank you, Steve!

This nearly solves my development issue. However, how should I approach pictures if there are several pictures per record? Should I make a series of fields? (IE: Pics1 Pics2 Pics3 ect.) or is there a better approach?

Re: How to approach photos and store them

PostPosted: Tue Feb 14, 2012 2:34 pm
by shannah
You could create a realtionship to another table that stores the pictures. Currently this would require you add new images by clicking on the relationship table, and clicking "Add New Related Record".

In the next release there will be an ajax uploader that will work inside the grid widget so that multiple images could be uploaded on the same form... but for now you have to do them one at a time.

Unless you have multiple fields for images (a fixed number).... up to you

-Steve

Re: How to approach photos and store them

PostPosted: Tue Feb 14, 2012 6:43 pm
by wisni1rr
Thanks again, Steve!

I will take that into consideration. I am new to xataface and many of the tools used to created dynamic database driven sites. I'm very eager to learn.

I'm sure I'l be asking more questions as I get going.

Thanks again!

Re: How to approach photos and store them

PostPosted: Wed Feb 15, 2012 12:55 pm
by wisni1rr
I have a concern involving saving the file(s) outside of the database.

What happens if someone is saving a new file in a new record but the file has the same name such as Listing.pdf?

This would overwrite the previous similarly named file, correct?

How could I circumvent this?