seeking advice on using images in content management systems
Posted: Tue Dec 26, 2006 6:51 am
hello folk
i developed an online product catalogue for a client recently, which makes use of a mysql backend. each product has some textual data related to it, as well as an image. each product is also uniquely identified with an id. the textual data aspect was straight forward to implement. the image functionality however was quirky.
since each product had its own row in a database, i included a column called image, of type varchar(250), which stored a url string to where the image had already been uploaded to the filesystem, ie :'images/forks/xtreme_fork_3000.jpg'. storing the image's url as a varchar made it really easy to display the image when users viewed the products on the front-end.
but the point it that my client had to first upload the image and then add the actual product in the database.
uploading the image was handled through a simple upload file form. then, when creating the new product (ie: filling in the form details), when the turn to input the image url came, i made a drop-down list of all the images available (the amount of products would never exceed 20, but this could be problematic for larger catalogues).
this whole design has simple pro's and con's: essentially, i'm storing images in the filesystem and not in the database. all the database does is contain image source url's to each image. this was easy to implement but sucks for large scale systems (remember the drop-down list). it also makes use of a 2-phased product-creation procedure that involves the user going back and forth between upload-image and create-product pages.
what i'd like to know is what is the best practise out there? i am coding everything from scratch, so please don't recommend i look into 3rd party (open source) software. yes i know, buy vs build should always be considered, and it has been. anyhow, having said that, i can't imagine the actuall coding bit being too tricky. i just need to know what you guys think about my overall design, and what i should perhaps be doing instead.
this was the first content management system with images that i ever designed/coded, so i hardly expected my first design attempt to be breath-taking.
merry christmas to everyone from sunny cape town, south africa.
i developed an online product catalogue for a client recently, which makes use of a mysql backend. each product has some textual data related to it, as well as an image. each product is also uniquely identified with an id. the textual data aspect was straight forward to implement. the image functionality however was quirky.
since each product had its own row in a database, i included a column called image, of type varchar(250), which stored a url string to where the image had already been uploaded to the filesystem, ie :'images/forks/xtreme_fork_3000.jpg'. storing the image's url as a varchar made it really easy to display the image when users viewed the products on the front-end.
but the point it that my client had to first upload the image and then add the actual product in the database.
uploading the image was handled through a simple upload file form. then, when creating the new product (ie: filling in the form details), when the turn to input the image url came, i made a drop-down list of all the images available (the amount of products would never exceed 20, but this could be problematic for larger catalogues).
this whole design has simple pro's and con's: essentially, i'm storing images in the filesystem and not in the database. all the database does is contain image source url's to each image. this was easy to implement but sucks for large scale systems (remember the drop-down list). it also makes use of a 2-phased product-creation procedure that involves the user going back and forth between upload-image and create-product pages.
what i'd like to know is what is the best practise out there? i am coding everything from scratch, so please don't recommend i look into 3rd party (open source) software. yes i know, buy vs build should always be considered, and it has been. anyhow, having said that, i can't imagine the actuall coding bit being too tricky. i just need to know what you guys think about my overall design, and what i should perhaps be doing instead.
this was the first content management system with images that i ever designed/coded, so i hardly expected my first design attempt to be breath-taking.
merry christmas to everyone from sunny cape town, south africa.