PDA

View Full Version : Some advise on how to manage photos on a site


cocoonfx
04-09-2008, 09:32 PM
Hello


I have taken on a client who has about 50 images they want to display with a description. The images will change on a monthly basis along with the descriptions.

The customer has a spreadsheet with a list of the image numbers and then the descriptions.

Would a MySQL table be the best solution and then have PHP code?

If there are any other recommendations i would appreciate it.

Regards
Cocoonfx

pete
04-09-2008, 09:46 PM
How does your client want to update his images? If he likes using Excel then he could export the spreadsheet as a csv which you can then process using PHP.

Just run through the csv file and create the HTML, hint http://uk3.php.net/manual/en/function.fgetcsv.php example 1.

MySQL is an obvious choice but you will need to create an upload area and a place for descriptions which is quite easy if you know PHP but not so if you don't. There are also many open source gallery apps but some can be overkill or not ideal for the site. See if this would work for your client http://gallery.menalto.com/

cocoonfx
04-09-2008, 11:39 PM
Hi Pete


Thanks for your quick reply. I know that CSV can be uploaded via EDI or other methods into SQL tables etc... but i didn't know PHP can do this. I take it if i created a test.csv like in the example and uploaded it and used the code it will count the number lines etc...

I think if i can work this out i then can combine this with MySQL as well......

You don't know of any tuts on CSV handling and PHP so i can see examples of what else could be done?

Regards
Cocoonfx

pete
04-10-2008, 07:44 AM
Look through the PHP manual for CSV or attach your csv file here and I'll point you in the right direction.

You still need to decide on who will update the images (you or your client) if your client wants to then you need to create a GUI for him to do that.

davidj
04-10-2008, 07:51 AM
I have used the FILE function to do this

file will array by line where you can then process further by looping through using a foreach and exploding on comma's giving a multidimensional array.

giving...


$lines[0][0] //<< first line, first entry
$lines[0][1] //<< first line, second entry
$lines[0][2] //<< first line, third entry





http://us.php.net/manual/en/function.file.php

there is also a fgetcsv function available but i have not used this

http://us.php.net/fgetcsv

cocoonfx
04-10-2008, 04:26 PM
Thanks guys


So if i use the array function like DJ says this will give me a table on the site with the data.

Thinking about it if i uploaded the CSV and included this into a create table command which i then can create php front end and display the images, and descriptions. I then could have a script to backup the table as soon as a new CSV is uploaded i then would just need to have the php front pickup the updates.

Sorry for rambling but its just given me a clear idea on where i want to go.

Be warned i could be back with some questions!

m1a2x3x7
04-10-2008, 05:04 PM
xml would be an easier way to go then csv.