Results 1 to 3 of 3

Thread: Modify image gallery style image size proportional instead of px

  1. #1
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Modify image gallery style image size proportional instead of px

    Can this be modified to size the image proportional insted of set width and height.
    HTML Code:
    <style type="text/css">
    
    .slideshow{ /*CSS for DIV containing each image*/
    float: left;
    margin-left: 5px;
    margin-right: 5px;
    margin-bottom: 16px;
    }
    
    .slideshow img{ /*CSS for each image tag*/
    border: 0;
    width: 173px;
    height: 127px;
    }
    
    #navlinks{ /*CSS for DIV containing the navigational links*/
    width: 200px;
    }
    
    #navlinks a{ /*CSS for each navigational link*/
    margin-right: 8px;
    margin-bottom: 3px;
    font-size: 100%;
    }
    
    #navlinks a.current{ /*CSS for currently selected navigational link*/
    background-color: yellow;
    }
    </style>
    The PHP file that goes with the above is
    PHP Code:
    <?
    Header
    ("content-type: application/x-javascript");

    function 
    returnimages($dirname=".") {
       
    $pattern="\.(jpg|jpeg|png|gif|bmp)$";
       
    $files = array();
       
    $curimage=0;
       if(
    $handle opendir($dirname)) {
           while(
    false !== ($file readdir($handle))){
                   if(
    eregi($pattern$file)){
             
    $filedate=date ("M d, Y"filemtime($file));
                     echo 
    'galleryarray[' $curimage .']=["' $file '", "'.$filedate.'"];' "\n";
                     
    $curimage++;
                   }
           }

           
    closedir($handle);
       }
       return(
    $files);
    }

    echo 
    "var galleryarray=new Array();" "\n";
    returnimages();
    ?>

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Yes. That's controlled here:
    Code:
    .slideshow img{ /*CSS for each image tag*/
    border: 0;
    width: 173px;
    height: 127px;
    }


    Hmm... note that .jpe is also a valid extension for jpegs.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2007
    Posts
    83
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by djr33 View Post
    Yes. That's controlled here:
    Code:
    .slideshow img{ /*CSS for each image tag*/
    border: 0;
    width: 173px;
    height: 127px;
    }


    Hmm... note that .jpe is also a valid extension for jpegs.
    What I need is that to be proportional because the images are different sizes and 1 setting doesn’t work for all. So if I could set either the width or height the opposite would be proportional to that. I tryed % didnt work

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
  •