existing table field holds path+image.

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

existing table field holds path+image.

Postby neotrode » Fri Jan 28, 2011 2:06 pm

Hello.

I am trying to create a simple backend using Xatabase to edit existing tables from an old website. The table in question has a field to hold the image filename and location relative to the root of the html folder. The php pages throughout the website rely on the field and its full path and filename.

Is there a setting I can turn on in Xataface to include (and use) the full path and filename of the image when it is uploaded?

With the current setup, I am using the /file folder from IMM and the image uploads save to the table with just the filename.

I am hoping there is a simple parameter to set for this option.

Thanks!

-Frank
neotrode
 
Posts: 26
Joined: Mon Dec 20, 2010 11:08 am

Re: existing table field holds path+image.

Postby shannah » Fri Jan 28, 2011 2:22 pm

Storing just the filename is the most flexible because it frees you up to change the actual location where the files are stored. However, there are a number of ways to turn it into a path instead of just a file name. One way that I can think of is to create another field that just holds the filename, but use the beforeSave() trigger to populate the appropriate data in the other field (i.e. the one that should contain the path).

Another strategy would be instead to just add the path to the filename in the same column during the beforeSave trigger.. but there would likely be some other things you'd have to muck with in this approach to maintain compatibility with other Xataface functions that expect the field to only contain a file name.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: existing table field holds path+image.

Postby neotrode » Fri Jan 28, 2011 2:34 pm

That's what I thought.

I was considering writing code to strip the paths from the column but then I would have to dig around all of the website's code and append the path to the IMG tags specific to image set etc... My gut tells me I am probably going to have to go that route.

I agree with you, saving just the filename is the way to go for the most flexibility but the old website did not have flexibility in mind.
neotrode
 
Posts: 26
Joined: Mon Dec 20, 2010 11:08 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 15 guests

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