Is there a way to resize menu images with code/script?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
les35
Advanced
Advanced
Posts: 12
Joined: Mon Feb 20, 2006 6:46 pm

Is there a way to resize menu images with code/script?

Post by les35 »

The images I am using in my menu are not hosted by myself, so I cannot resize them directly. I'm looking for a way to resize them with code/script.
Something similar to the width and height tags you can add to an image in HTML. (i.e. <img src="image.jpg" width="16" height="16"> )


Specifically, I will have a list of external links to various websites. I want to use each websites favicon as an image next to each link in the menu.

Like this:
aI("image=http://www.google.com/favicon.ico;text= ... google.com;");

The favicons show up fine, but the problem is that some of them are 16x16 pixels while others are 32x32 pixels. This is making the menu look bad. I want to be able to rescale all images to 16x16.

Anybody know a way to do this?
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Pulling stuff you rely on from other sites is always a bad idea. Consider the other site being down, slow 'net traffic, etc. Those, and many others, will make your site look bad with slow loading at best.

Since you already have the url of the graphic(s) you want, just go get them and put them on your server; e.g., http://www.google.com/favicon.ico in your browser will get you a page with nothing but the Google favicon. Then just save it locally, resize, and upload to your server.
John
les35
Advanced
Advanced
Posts: 12
Joined: Mon Feb 20, 2006 6:46 pm

Post by les35 »

John wrote:Pulling stuff you rely on from other sites is always a bad idea. Consider the other site being down, slow 'net traffic, etc. Those, and many others, will make your site look bad with slow loading at best.

Since you already have the url of the graphic(s) you want, just go get them and put them on your server; e.g., http://www.google.com/favicon.ico in your browser will get you a page with nothing but the Google favicon. Then just save it locally, resize, and upload to your server.
Thanks for the reply and the advice.

I know 99% of the time it is best to host images myself, but this time it's one of the cases that fall in that 1%.

The menu is not going on a webpage, but rather in a widget that will be distributed and used by thousands each day. At this point in the project, I don't have the resources to permit me to host all the icons myself.

Again, thanks for you help, but I would still like to know if it is possible to do what I am asking. Perhaps if someone doesn't know directly how to do it, maybe you can tell me how to find the aI() function which handles the menu items so that I can modify it. I haven't been able to find it in the code.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Here you go, this should work - Not tested though:

Code: Select all

aI("imageheight=16;imagewith=16;image=http://www.google.com/favicon.ico;text=Google;url=www.google.com;");


Hope this helps,
Andy
les35
Advanced
Advanced
Posts: 12
Joined: Mon Feb 20, 2006 6:46 pm

Post by les35 »

Andy wrote:Here you go, this should work - Not tested though:

Code: Select all

aI("imageheight=16;imagewith=16;image=http://www.google.com/favicon.ico;text=Google;url=www.google.com;");


Hope this helps,
Andy
That worked! (once i fixed your spelling of "width" ;) )

Thanks a lot Andy!
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Oops :oops:

That's what ya get fer rushin :D

Although I did say it hadn't been tested, hehe

I'm glad it's working though.

Have fun,
Andy
Post Reply