Results 1 to 8 of 8

Thread: photo gallery doent work WHY

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

    Default photo gallery doent work WHY

    Can someone tell me why this dont work. I down loaded a photo gallery from
    http://www.dynamicdrive.com Here the getpics.php is said to save in the gallery folder I did that (also it automaticly makes a getpics.php. file that keeps coming back even if you delete it?)

    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 H:i:s"filemtime($file));
                     echo 
    'galleryarray[' $curimage .']=["' $file '", "'.$filedate.'"];' "\n";
                     
    $curimage++;
                   }
           }

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

    echo 
    "var galleryarray=new Array();" "\n";
    returnimages();
    ?>
    Heres the htm page
    HTML Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>New Page 1</title>
    
    
    <style type="text/css">
    
    .slideshow{ /*CSS for DIV containing each image*/
    float: left;
    margin-right: 10px;
    margin-bottom: 10px;
    }
    
    .slideshow img{ /*CSS for each image tag*/
    border: 0;
    width: 200px;
    height: 106px;
    }
    
    #navlinks{ /*CSS for DIV containing the navigational links*/
    width: 400px;
    }
    
    #navlinks a{ /*CSS for each navigational link*/
    margin-right: 8px;
    margin-bottom: 3px;
    font-size: 110%;
    }
    
    #navlinks a.current{ /*CSS for currently selected navigational link*/
    background-color: yellow;
    }
    </style>
    <style type="text/css">
     body {
      background-color: #88B8DE;
     }
    </style>
    
    </head>
    
    <body>
    
    <script src="http://www.wichita.com/gallery/getpics.php" type="text/javascript"></script>
    
    <script type="text/javascript">
    
    /***********************************************
    * PHP Photo Album script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
    * This notice must stay intact for legal use
    ***********************************************/
    
    var dimension="3x2" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc
    var imagepath="http://www.wichita.com/gallary/" //Absolute path to image directory. Include trailing slash (/)
    var href_target="new" //Enter target attribute of links, if applicable
    
    //Toggle popup link setting: popupsetting[0 or 1, "pop up window attributes" (if 1)]
    var popupsetting=[1, "width=500px, height=400px, scrollbars, resizable"]
    
    //Toggle image description: descriptionprefix[0 or 1, "Text to show" (if 1)]
    var descriptionprefix=[1, "Photo "]
    
    //Sort images by date? ("asc", "desc", or "")
    //"desc" for example causes the newest images to show up first in the gallery
    //"" disables this feature, so images are sorted by file name (default)
    var gsortorder="desc"
    
    //By default, each image hyperlinks to itself.
    //However, if you wish them to link to larger versions of themselves
    //Specify the directory in which the larger images are located
    //The file names of these large images should mirror those of the original
    //Enter a blank string ("") to disable this option
    var targetlinkdir=""
    
    /////No need to edit beyond here///////////////////
    
    function sortbydate(a, b){ //Sort images function
    if (gsortorder=="asc") //sort by file date: older to newer
    return new Date(a[1])-new Date(b[1])
    else if (gsortorder=="desc") //sort by file date: newer to older
    return new Date(b[1])-new Date(a[1])
    }
    
    if (gsortorder=="asc" || gsortorder=="desc")
    galleryarray.sort(sortbydate)
    
    var totalslots=dimension.split("x")[0]*dimension.split("x")[1]
    
    function buildimage(i){
    var imagecompletepath=(targetlinkdir!="")? targetlinkdir+galleryarray[i][0] : imagepath+galleryarray[i][0]
    var tempcontainer='<a href="'+imagecompletepath+'" target="'+href_target+'" onClick="return popuplinkfunc(this)">'
    tempcontainer+='<img src="'+imagepath+galleryarray[i][0]+'" title="'+galleryarray[i][0]+' ['+galleryarray[i][1]+']" />'
    tempcontainer+='</a><br />'
    tempcontainer+=(descriptionprefix[0]==1)? descriptionprefix[1]+(i+1) : ""
    return tempcontainer
    }
    
    function jumptopage(p){
    var startpoint=(p-1)*totalslots
    var y=1;
    for (i=0; i<totalslots; i++){
    document.getElementById("slide"+i).innerHTML=(typeof galleryarray[startpoint+i]!="undefined")? buildimage(startpoint+i) : ""
    }
    while(document.getElementById("navlink"+y)!=null){
    document.getElementById("navlink"+y).className=""
    y++
    }
    document.getElementById("navlink"+p).className="current"
    }
    
    var curimage=0
    for (y=0; y<dimension.split("x")[1]; y++){
    for (x=0; x<dimension.split("x")[0]; x++){
    if (curimage<galleryarray.length)
    document.write('<div id="slide'+curimage+'" class="slideshow">'+buildimage(curimage)+'</div>')
    curimage++
    }
    document.write('<br style="clear: left" />')
    }
    
    function popuplinkfunc(imgsrc){
    if (popupsetting[0]==1){
    var popwin=open(imgsrc.href, "popwin", popupsetting[1])
    popwin.focus()
    return false
    }
    else
    return true
    }
    
    </script>
    
    <!--Below HTML code refers to the navigational links for the gallery-->
    
    <div id="navlinks">
    <script type="text/javascript">
    for (i=1; i<Math.ceil(galleryarray.length/totalslots)+1; i++)
    document.write('<a id="navlink'+i+'" href="javascript:jumptopage('+i+')\">Page'+i+'</a> ')
    document.getElementById("navlink1").className="current"
    </script>
    </div>
    </body>
    
    </html>

  2. #2
    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

    Well, I checked the URL:

    PHP Code:
    http://www.wichita.com/gallery/getpics.php 
    and there was nothing there, or it wouldn't allow me to see it.

    Anyways, there could be any number of problems. If the server isn't PHP enabled, this script will not work. If it uses a proprietary PHP syntax, the getpics.php would need to be modified for that syntax. If it follows strict PHP syntax, there are two modifications (red) that may need to be made:

    Code:
    <?php
    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 H:i:s", filemtime($file));
                     echo 'galleryarray[' . $curimage .']=["' . $file . '", "'.$filedate.'"];' . "\n";
                     $curimage++;
                   }
           }
    
           closedir($handle);
       }
       return($files);
    }
    
    echo "var galleryarray=new Array();" . "\n";
    returnimages();
    ?>
    Only one or the other of the above modifications may be needed, or they both may, or neither.

    To be of much more help, we would need a link to the problem page.

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

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

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

    Default testing gallery

    test
    basicly just the gallery page

  4. #4
    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

    You forgot to close the style tag:

    Code:
    <style type="text/css">
    
    .slideshow{ /*CSS for DIV containing each image*/
    float: left;
    margin-right: 10px;
    margin-bottom: 10px;
    }
    
    .slideshow img{ /*CSS for each image tag*/
    border: 0;
    width: 200px;
    height: 106px;
    }
    
    #navlinks{ /*CSS for DIV containing the navigational links*/
    width: 400px;
    }
    
    #navlinks a{ /*CSS for each navigational link*/
    margin-right: 8px;
    margin-bottom: 3px;
    font-size: 110%;
    }
    
    #navlinks a.current{ /*CSS for currently selected navigational link*/
    background-color: yellow;
    }
    </style>
    </head>
    And:

    Code:
    <script src="http://www.wichitarcraceway.com/test/gallery/getpics.php" type="text/javascript"></script>
    is a file not found error.
    - John
    ________________________

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

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

    Default

    Sorry amiture misstakes there oh wait Iam
    I got that fixed. Now the pics try to come up but just see X but looking at properties of X it has image name

    Never mind on X I needed a locaction for link back to itself
    Seems rather slow but works.
    Thanks again
    Last edited by big-dog1965; 09-10-2007 at 11:08 PM.

  6. #6
    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

    Seems rather slow but works.
    2007_Free_Race2.jpg at 1.2 MB (1,243,150 bytes)? Come on.

    If you were to resize and optimize your images they would come up much faster. This script also allows you to use two directories, one for thumbnails and one for larger images. If you were to make small optimized images for the thumbnail directory and larger optimized versions for the larger images directory, it would load very fast and each larger image would take little time to load as well.
    - John
    ________________________

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

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

    Default

    I spent some time looking for a script to resize but the ones I found I didnt know how to make them work and seemed that most just done jpg. It would be nice to have one that would resize what ever was put into a folder jpg, png, gif then make another some % smaller and put that into another folder.

  8. #8
    Join Date
    Oct 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hey im having the same problem and have used both versions of the .js

    http://www.webedgeinc.com/testsite/010/pics/getpics.php

    http://www.webedgeinc.com/testsite/010/pics/gallery.htm

    just a quick test. thanks for the time.

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
  •