Suggests for icon display


This is kind of a general question, I'm not sure how to start this. I'd like to provide the user with a list of icons they can choose to associate with some data.

So.. I'll probably have like 80 icons all together, each of which are 16x16 pixels, that's about 1kb each. That would be in total lets say safely 100kb - should I somehow make them download all the icons as soon as they visit my page - or is there some slick way to only transmit the icons they are trying to view?

Another point on that - what would be a good way to display so many icons? I was thinking a popup menu that had categories, and sub categories like:

    Icons -> Sports   -> baseball
                             -> hockey
                 Parties  -> birthday
                             -> office
                             -> holiday
                 Holidays -> xmas
                              -> halloween
                 Animals  -> etc

you get the idea. So if I do something like that, will I have to make sure all the icons are transmitted to the user at page load? Will a copy of the icons remain on their disk somehow so I won't have to keep sending them the whole icon batch everytime they visit?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineNo oneCommented:
Hi minnirok,

It sounds like you will need some sort of way to save the user preferences, so you are looking at cookies, sessions, and a scripting language connecting to  MySQL.  

Depending on how complex you want to make this, you could load all of this into a small SQL table and display icons as the user browsers by doing 16k each, I wouldn't worry too much about bandwidth but if there is a way to limit how many display at a time, your users will appreciate it.

With the script here you preloading all the images into the browser's cache, if the cache hasn't been cleared (most people don't clear the cache on their browser unless they are having problems) the browser would probably reuse the same image without reloading them.

minnirokAuthor Commented:

     "the browser would probably reuse the same image without reloading them."

How could I check if the browser is actually using the images from the cache instead of always asking from the server everytime the page is visited?
If it were really the case that it just uses the image from the cache, that would be perfect.

I would do a test with let say 5 images available, I would visit the page once, than I would change the images but with the same name,

i.e. pic1.gif, pic2.gif, pic3.gif etc. the first time

Then you use different pictures but with the same name.

Then you revisit the page if you still have the first set of image than the browser used the ones in the cache on refresh you should see the new set of image.

Actually I don't think you even have to use the preload script for that.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Thanks for the points and the grade.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.