Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:13

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


Poster: les35
Dated: Monday February 20 2006 - 18:04:08 GMT

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;url=www.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?


Poster: John
Dated: Tuesday February 21 2006 - 14:09:10 GMT

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.


Poster: les35
Dated: Tuesday February 21 2006 - 15:04:06 GMT

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.


Poster: Andy
Dated: Thursday February 23 2006 - 12:56:09 GMT

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

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


Hope this helps,
Andy


Poster: les35
Dated: Thursday February 23 2006 - 15:23:57 GMT

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

Code:
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!


Poster: Andy
Dated: Thursday February 23 2006 - 15:26:31 GMT

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