Page 1 of 1

seeking advice on using images in content management systems

Posted: Tue Dec 26, 2006 6:51 am
by konstandinos
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.

Re: seeking advice on using images in content management sys

Posted: Tue Dec 26, 2006 7:28 am
by timvw
konstandinos wrote: but the point it that my client had to first upload the image and then add the actual product in the database.
What keeps you from adding the input type="file" to the rest of the form where the actual product is 'managed'?
konstandinos wrote: 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).
So your problem is: 'easily let the user pick an image'. (I fail to see how the actual storage implementation of the image is related to this problem....)
konstandinos wrote: this was easy to implement but sucks for large scale systems (remember the drop-down list).
How would you define 'large scale system'?
konstandinos wrote: 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.
So you want to build 1 form that allows the user to do the two at the same time... I still don't see how the actual storage system of the image has any influence on this problem...

Here is an example of a form that allows the user to add images to an article (real estate):

http://www.timvw.be/wp-content/images/immo.jpg

Posted: Tue Dec 26, 2006 8:22 am
by konstandinos
ok i see your point.

i assume the following is correct:

- i have 1 page for managing the product (including its image).
- in the image field, i continue storing the url to the image as varchar(x), but also include a button that takes me to a "select image" mini-window (like your example).
- that mini-window not only displays a list of all the current images, but also has an upload form section, that allows uploading of new images.
- if an image is uploaded in this mini-window, the list of images is refreshed.
- the user selects an image and clicks ok -> which ends up closing the mini-window and populating the image_url field in the product-manage page with the url of the image that was selected.

your simple analysis of my problem is correct: i wanted the user to only need to worry about one product-management page. the issue of storage of image_url as varchar vs the actual image as BLOB was a side concern. i now see that i can continue using the file-system approach.

your mini-window idea is the insight i was seeking. i never thought of doing that before i read your post.

thanks for the useful reply.

Posted: Thu Jan 04, 2007 5:38 pm
by konstandinos
hi timvw (and others)

back to the image manager (mini-window on the screenshot you provided) - was that whole thing coded in php?