|
Posted by Kentor on 07/28/06 02:33
Hmmm. another table is a good idea... but it will require so much
recoding :(
Rik wrote:
> Kentor wrote:
> > Hello, I have a website to list vacation rentals and housings. I want
> > to be able to modify images after a user has submitted their listing
> > with/without images.
> > How it works: the first time they submit their listing, they enter all
> > the info and then add any images onto a field by browsing to the
> > image.
> > They can have up to 7 images. Once the person is done I have two
> > fields
> > in my database "pics" and "ext" pictures are to set the number of
> > pictures for this listing and ext are the extensions for each picture.
> > The ext field goes something like this: jpg.bmp.jpg. and pics would be
> > 3. the way the files are stored are by post id, so for example if the
> > post id is 192 then images would be 192_0.jpg 192_1.bmp and 192_2.jpg.
> > Ok now, i need to find some way to allow people to delete or change
> > the images or upload images if they dont have any at all.... I need to
> > somehow display the already existing images, and then check each field
> > to see if its empty or not and somehow concatinate with the existing
> > images or something. After the function is executed, a simple update
> > statement is needed.
> > I just get lost in all of this. Any help will be greatly appreciated.
>
> IMHO it's a very, very ineffective way to handle the images.
> If you want to allow them to upload different kinds of images, I'd just make
> a seperate tabel called images, containing the post id & the image name.
> Give the images some kind of unique filename (your naming scheme is
> allright) and store that. That way, image adding & deleting is just a matter
> of adding/deleting records (and the files obviously). You could even give
> them the option to order them in the way they wish.
>
> Golden rule in databases: don't try to put information in one field you'll
> always have to split up later to be of any use.
>
> Another way to do this is to create a folder for every post id, and store
> the images there.
>
> Grtz,
> --
> Rik Wasmus
Navigation:
[Reply to this message]
|