Link to home
Start Free TrialLog in
Avatar of alex_wareing
alex_wareing

asked on

Image colors from a database

I'm not really sure in which topic are this should be as which language to do this is part of my question.

I'm developing a templated based CMS solution. Each client has their own website and the content is drawn from a DB and put into the page. Each client designates a set of colors for the theme of their site (colors 1-4), the problem is i want to start putting graphics around the pages, and using graphical buttons instead of standard form controls. However i can't just create a standard set of buttons because they won't nesscarily look good in the theme next to the clients colors. and because each client (100+) specifies their own colors i can't legislate for this.

Is there anyway i can use graphics on a page where some element of the color is drawn from a Database?

The pages are written in ASP, but i would consider using any language to fix this problem as long as it will work in an ASP page
Avatar of GrandSchtroumpf
GrandSchtroumpf

ImageMagick does all kinds of image manipulation:  http://www.imagemagick.org/ (their site is currently down).
ImageMagick is not meant to be used with ASP, but it seems it can be done using some OLE component...  You can search google for more info on the subject.
ASKER CERTIFIED SOLUTION
Avatar of Fuzzyfish1000
Fuzzyfish1000
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
and to keep the display part seperated from content I'd use CSS. Just an addition, totally agree with Fuzzyfish - all point for him
Avatar of alex_wareing

ASKER

Fuzzyfish1000 - i have thought of this approach before however, what can i do if i want rounded edges and the page background could be any color?
If you only have 4 colors to choose from (colors 1-4) then it shouldn't be hard to make the same button with each of the possible combinations.  Granted, as you expand the color offering, this could come out to be a large number of images, but if you have the space for it, it keeps you from having to perform run-time image processing.  You could then name the buttons with a code stating which combination of colors they use and use the customers color setting to determine which image to load.  Ie, if the customer has chosen color 3, then their button would be /images/submitbutton3.gif, whereas another customer may load /images/submitbutton2.gif.  If there are two colors that would affect the button, you just expand the code on the end.  Ie, if the customer has chosen 2 as the highlight color and 3 as the base color, your img src= becomes /images/submitbutton2-3.gif.  This same technique could be carried forward into any number of combinations.  Also, it could be written that the 2-3 combination for an image used in the title would not be the same colors as a 2-3 combination used in the footer.  It is just a matter of the code knowing which portion of theme affects the image you are loading.  It is feasible that even if the theme allows the selection of colors for 60 different areas, only one or two of the colors would affect any given button, so you wouldn't have to have the submitbutton with 4^60 different images (60 color areas, each with a possible choice of 4 colors) but would instead only have 4^2 (2 colors affecting the image, with those two chosen from 4 colors).
I guess you've got to decide how much flexibility you actually need - I often get clients approaching me and saying things like, we want a database that can accept any sort of input, or I want to be able to completely re-design the layout of my site without any technical knowledge - at which point I stop them, and get them to consider their actual requirements. I would want buttons of any colour, with any shape, and with any background, I'd suggest you may want to fix yourself to a specification, or at least a set of limitations.

For instance, it would be quite easy to produce buttons with rounded edges, with transparent parts for changing to any colour, that would look good on a white background. I don't suppose once you've done one set, it would take you long to create 10 sets of buttons, for 10 sets of background colours. Your only other alternative is to dynamically create the images using an object like the chestysoft one - or use flash or Java (which I wouldn't recommend). The downside of dynamic creation is it doesn't lend itself to high-volume traffic websites, without a lot of server power behind it.

If you compromise and have square edged buttons (even with drop shadows or similar), you can use the table background with transparent sections solution just fine...