Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: PHP Photo Album script v2.11 Pictures don't show up

  1. #1
    Join Date
    Sep 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default PHP Photo Album script v2.11 Pictures don't show up

    1) Script Title: PHP Photo Album script v2.11

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...photoalbum.htm

    3) Describe problem: Pictures don't show up.

    I've tried everything and I just can't get this thing to work.

    I tried the PHP 5.3+ fix here: http://www.dynamicdrive.com/forums/s...m-script-v2-11 it makes the problem worse. Instead of just the pictures not showing up, nothing shows up. I know I'm running 5.4.7 : http://www.klaification.com/test.php

    I tried the .zip thing suggested here: http://www.dynamicdrive.com/forums/s...746#post225746 and it also doesn't show the pictures. You can see that here: http://www.4crg.org/pics.htm

    I'm getting this error from both the .zip one and the one with my html: alert("Photo Album ID must contain only letters, numbers, or underscore, and cannot start with a number")
    At one point I did get the right output for getalbumpics.php and the pictures still did not show. I've only been changing the getalbumpics.php file for the PHP 5.3+ fix and I tried it with both versions in the file.

    The .zip install has a photo album id of 'jaguar' and mine has 'rollerderby' I haven't changed either of these ever.

    Any ideas on how to get this to work?
    Last edited by KayLawless; 09-26-2012 at 04:18 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,933
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    The .zip version is working but the images aren't showing up. I'm not sure why. I can navigate to www.4crg.org/pics/getalbumpics.php?id=jaguar and that looks right:

    Code:
    var jaguar={
    	baseurl: "http://4crg.org/pics/",
    	images: [
    		[0, "hi.JPG", "Sep 24, 2012 20:45:04"],
    		[1, "howsitgoing.jpg", "Sep 24, 2012 20:46:30"],
    		[2, "goodhowareyou.jpg", "Sep 24, 2012 20:47:19"],
    		[3, "decent.jpg", "Sep 24, 2012 20:48:24"],
    		[4, "justdecent.jpg", "Sep 24, 2012 20:49:05"],
    		[5, "yup.jpg", "Sep 24, 2012 20:43:37"],
    		["placeholder"]
    	],
    	desc: []
    }
    Except that the baseurl doesn't have the www. part in it. It should. It looks like the server has some sort of rewrite engine on. I can't see any of that. But I'm seeing the results. You cannot navigate to anything on that domain without the www. part. If you try, you get redirected the the index page with www. added. Either that rewrite engine needs to be modified or www. has to be added to the baseurl when and if it's missing.

    Try this getalbumpics.php file, replace the existing one in the zip installation:

    PHP Code:
    <?php
    Header
    ("content-type: application/x-javascript");

    function 
    returnimages($dirname=".") {
       
    $pattern='/\.(jpg|jpeg|png|gif|bmp)$/i';
       
    $curimage=0;
       if(
    $handle opendir($dirname)) {
           while(
    false !== ($file readdir($handle))){
                   if(
    preg_match($pattern$file)){
             
    $filedate=date ("M d, Y H:i:s"filemtime($file));
                     echo 
    "        [$curimage, \"$file\", \"$filedate\"],\n";
                     
    $curimage++;
                   }
           }
           echo 
    '        ["placeholder"]' "\n";
           
    closedir($handle);
       }
    }

    $photovar=$_GET['id'];
    if (!
    preg_match('/^[a-z0-9_]+$/i'$photovar)){
        echo 
    "alert(\"Photo Album ID must contain only letters, numbers, or underscore, and cannot start with a number\")";
        die();
    }
    echo 
    "var $photovar={\n";
    echo 
    "    baseurl: \"http://www." $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/\",\n";
    echo 
    "    images: [\n";
    returnimages();
    echo 
    "    ],\n";
    echo 
    "    desc: []\n";
    echo 
    "}\n";
    ?>
    The browser cache may need to be cleared and/or the page refreshed to see changes. And the server might need to have its cache cleared too. On the pics.htm page you can add the highlighted:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript" src="pics/getalbumpics.php?id=jaguar&bust=7329"></script>
    
    <script type="text/javascript">
    
    //Optional, manual description for  . . .
    to make the server fetch the file new. Each time you change the file, you need to use a different number. But that's only if the server is caching it.
    - John
    ________________________

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

  3. #3
    Join Date
    Sep 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I tried those things and it's still not working. I did notice that the picture placeholder things are disappearing slower though.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,933
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    Looks like the getalbumpics.php file has not been updated. But I cannot tell for sure.

    OK, go back to the original and add this script as shown to pics.htm:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript" src="pics/getalbumpics.php?id=jaguar&bust=7329"></script>
    <script type="text/javascript">
    jaguar.baseurl = 'http://www.4crg.org/pics/";
    </script>
    <script type="text/javascript">
    
    //Optional, manual description for particular pictures inside album
    //Syntax: albumid.desc[index]="Picture description here"
    //eg: jaguar.desc[2]="This is description for the 3rd picture in the album"
    //eg: jaguar.desc[6]="This is description for the 7th picture in the album"
    
    </script>
    
    <script type="text/javascript" src="ddphpalbum.js">
    
    /***********************************************
    * PHP Photo Album script v2.0- (c) Dynamic Drive DHTML c . . .
    - John
    ________________________

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

  5. #5
    Join Date
    Sep 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Still no dice.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,933
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    Sorry about that, typo on my part:

    Code:
    <script type="text/javascript">
    jaguar.baseurl = 'http://www.4crg.org/pics/";
    </script>
    Needs to be:

    Code:
    <script type="text/javascript">
    jaguar.baseurl = 'http://www.4crg.org/pics/';
    </script>
    The browser cache may need to be cleared and/or the page refreshed to see changes.
    - John
    ________________________

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

  7. The Following User Says Thank You to jscheuer1 For This Useful Post:

    KayLawless (09-25-2012)

  8. #7
    Join Date
    Sep 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hey! It works!!! Yay! Thank you so much! So the problem is just my redirect?

  9. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,933
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    Apparently it's a factor. However, the getalbumpics.php file in the .zip version is also updated for the major PHP 5.3+ things, so those updates most likely are also an issue and required (the code in the getalbumpics.php from the demo page probably will not work for you).

    Is that your redirect, as opposed to one imposed upon you by your host? Either way, if you have access, it could probably be tweaked so that it doesn't lead to this issue. But I'm not real up on redirects, though I do know that the optimal syntax can vary depending upon host.
    - John
    ________________________

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

  10. #9
    Join Date
    Sep 2012
    Posts
    7
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I found the code somewhere. It's in htaccess. I don't really mind since it's working now.

    Would you happen to know how to put a space between page and the number on the photo album navigation? Right now it's 'Page1' and I would like it to be 'Page 1'. I found where it writes it in the js file and tried all sorts of things like ' ', &nbsp;, &amp;nbsp;, \xa0 but none of that works.

  11. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,933
    Thanks
    43
    Thanked 3,192 Times in 3,155 Posts
    Blog Entries
    12

    Default

    It's making PHP report:

    PHP Code:
    $_SERVER["SERVER_NAME"
    without the www. part, even while rewriting it to include that in the address bar. That would be OK if it didn't also redirect all requests without the www. part to the site's index page. If one could make exceptions for images, scripts, css files . . . Or make it report SERVER_NAME with the www. part as a server normally will when that's in the address bar . . .

    But, as you say, it works.

    About the page thing, find this line in the script:

    Code:
    document.write('<a href="#Page' + i+ '" rel="'+i+'">Page'+i+'</a> ')
    The highlighted part is what's seen on the page. Change it to:

    Code:
    document.write('<a href="#Page' + i+ '" rel="'+i+'">Page '+i+'</a> ')
    Last edited by jscheuer1; 09-26-2012 at 01:42 AM. Reason: add info
    - John
    ________________________

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

Similar Threads

  1. PHP Photo Album script v2.11
    By nabilyb in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 02-03-2012, 02:41 PM
  2. PHP Photo Album script v2.11
    By bluetooter in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 07-03-2010, 02:00 AM
  3. Add Photo Title to PHP Photo Album Script
    By EdgeAgain in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 09-27-2009, 11:31 PM
  4. DD PHP Photo Album script - photo descrip
    By aavaughan in forum Dynamic Drive scripts help
    Replies: 4
    Last Post: 09-13-2007, 12:44 AM
  5. PHP Photo Album Script
    By Carter in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 06-25-2007, 01:40 AM

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
  •