Results 1 to 3 of 3

Thread: SwissArmy slideshow - problem with images of varying size/resolution

  1. #1
    Join Date
    Jul 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default SwissArmy slideshow - problem with images of varying size/resolution

    1) Script Title: Swissarmy Slideshow

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...army/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.

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Have you tried adding a rule for img element in your CSS? Something along these lines:
    Code:
    img{
    width:800px;
    height:600px;
    }
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by rangana View Post
    Have you tried adding a rule for img element in your CSS? Something along these lines:
    Code:
    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:

    Code:
    #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):

    Code:
    #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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •