Jump to content


Photo

Help with image/description uploading


  • Please log in to reply
3 replies to this topic

#1 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 08 June 2006 - 11:11 PM

Hello everyone, I'm stuck on a website that I am building for my neighbor. He's a used car dealer, and wants to have on his website the ability to upload 5 pictures of 1 car(he's going to have multiple cars of course) and a description of the car. (mileage, make, etc.) I know the code for uploading multiple pictures to a directory already, but I need help with uploading a description that he types for the pictures. Problem is, I'm trying to make this with PHP but not using a database, but i'm not really up to that level yet. Could someone help me out with this code so I can get this project over with? It would be very appreciated :)



#2 nogray

nogray
  • Members
  • PipPipPip
  • Advanced Member
  • 930 posts
  • LocationSan Francisco CA

Posted 08 June 2006 - 11:41 PM

You can orginze your data in folders so sorting and getting the info will be easier (without a database)

for example
for each new car, you make a directory with the car name (for example hona_civic)

When he uploads the images (each car pictures will go into its' own folder) save them with specific names (like pic_1.jpg pic_2.jpg, pic_3.jpg etc)

and save the description as files in the same folders (like desc_1.txt, desc_2.txt, desc_3.txt)

This way each picture will have it's own description.

Hope this helps.

NoGray.com


#3 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 08 June 2006 - 11:46 PM

thank you for replying nogray.

That was the idea I had going a while ago, but what he wants would be 5 pictures on a page (like in a directory folder like you said) and the description will appear at the bottom of the pictures. Now I'm wondering if there's any possible way that if when he saves the description like you said in a .txt file in the same directory, I can code something that will call in that description on the bottom of the page (almost like an include). What would you think?

#4 Fyorl

Fyorl
  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 09 June 2006 - 12:55 AM

That's possible, just read the text file:
$desc = file_get_contents('desc_1.txt');
and then echo it wherever you want. You could loop through the images in the directory, incrementing a variable such as $i as you go and then just use it to match the picture to the text. So if you were on pic_3.jpg, $i would also be at 3 and then you can just echo file_get_contents('desc_' . $i . '.txt');
[table]



Don't worry, the printer fairies will sort it out.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users