PDA

View Full Version : SwissArmy slideshow - problem with images of varying size/resolution



timecott01
07-02-2008, 08:56 AM
1) Script Title: Swissarmy Slideshow

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex14/swissarmy/index.htm

3) Describe problem:

I am using the Swissarmy slideshow in a website I am writing. The issue I have is that my source images, all landscape format, are of varying resolutions and size. some are quite big - i.e. 3000x 2000 etc. size. Ideally i want to post these pictures into the website without 'scaling' them first as i use them elsewhere.

I use the swissarmy parameters as follows:

slides.width=800; //use to set width of widest image if dimensions vary
slides.height=600; //use to set height of tallest image if dimensions vary

and call the slideshow:

new inter_slide(slides, 800, 600, 3000);

the result is that the images will appear at their original size - hence varied. Is there a way I can get Swissarmy to 'scale' all images to a fixed size, i.e. 800,600 or whatever I use in the parameters??
perhaps i am using the parameters in the wrong way,
any advice would be welcome.
thank you.
tim ecott.

rangana
07-02-2008, 09:14 AM
Have you tried adding a rule for img element in your CSS? Something along these lines:


img{
width:800px;
height:600px;
}

jscheuer1
07-02-2008, 11:30 AM
Have you tried adding a rule for img element in your CSS? Something along these lines:


img{
width:800px;
height:600px;
}


That won't scale them unless 800 x 600 is the aspect ratio of all the images, otherwise it will squish/blow them up them into those exact dimensions, along with all of the other images on the page. And the settings for Swiss Army are only for accommodating images that will already 'fit in the box'.

Now, using style may still work. If your images can all be scaled to within 'the box' by having just one dimension set, the browser generally will take care of the other (as long as the script doesn't interfere). Each slide show this script makes has a master division. Like for the first slide show on a page, 'master0' - so you could try a style like:


#master0 img {
width:800px;
}

Then if they all can 'fit in the box' like that, it should work out. You can even try (no good for IE 6 -, but a substitute can be found if it works well in other browsers):


#master0 img {
max-width:800px;
}

You should still also set the 'size of the box' as you are already doing in the script, otherwise it will use the actual dimensions of the first image it loads.

If you need more help:

Please post a link to the page on your site that contains the problematic code so we can check it out.