How to approach photos and store them

A place for users and developers of the Xataface to discuss and receive support.

How to approach photos and store them

Postby wisni1rr » Mon Feb 13, 2012 9:10 pm

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!!!
wisni1rr
 
Posts: 107
Joined: Mon Feb 13, 2012 9:03 pm

Re: How to approach photos and store them

Postby shannah » Tue Feb 14, 2012 11:21 am

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: How to approach photos and store them

Postby wisni1rr » Tue Feb 14, 2012 2:25 pm

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?
wisni1rr
 
Posts: 107
Joined: Mon Feb 13, 2012 9:03 pm

Re: How to approach photos and store them

Postby shannah » Tue Feb 14, 2012 2:34 pm

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: How to approach photos and store them

Postby wisni1rr » Tue Feb 14, 2012 6:43 pm

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!
wisni1rr
 
Posts: 107
Joined: Mon Feb 13, 2012 9:03 pm

Re: How to approach photos and store them

Postby wisni1rr » Wed Feb 15, 2012 12:55 pm

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?
wisni1rr
 
Posts: 107
Joined: Mon Feb 13, 2012 9:03 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 14 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved