Results 1 to 3 of 3

Thread: PHP Photo Album 2.11 - Image Title from File Name

  1. #1
    Join Date
    Apr 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Photo Album 2.11 - Image Title from File Name

    1) Script Title: PHP Photo Album 2.11

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

    3) Describe problem: I have installed an un-modified version of this script on a website I am creating for someone ... http://www.rjt-online.com/2010%20Website/photos3.php

    The only mods I have made to the script is altering the images sizes.

    How can I get the script to use the image file name (minus the file extension) as the title to be placed underneath each image?

    I have found a few threads regarding this but they all seem to be relating to an older version of the script and arent relative to v2.11.

    If an images was names ie "The House.jpg", I would like a title to appear underneath the image saying "The House".

    As it stands, I can't get the date %d or default %i to display below the existing images. At present I have it set to "".

    Does anyone know how I can modify the script to do this?

    I would like to try and keep to the basic script and not introduce the new version of lightbox or anything.

    Any help would be appreciated.

    Thanks!

  2. #2
    Join Date
    Nov 2006
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by cpthompson82 View Post
    I have found a few threads regarding this but they all seem to be relating to an older version of the script and arent relative to v2.11.
    I am also in the same predicament, I would expect this to be a standard function for this script since it is mostly dynamic, setting custom titles seems a little manual compared to just using the filenames.

    the closest I have found so far was to add...

    Code:
    <script type="text/javascript">
    
    (function(id){
    for(var i = 0; i < id.images.length; ++i){
    id.desc[i] = id.images[i][1].replace(/\.[^\.]+$/, '');
    }
    })(myimages);
    
    </script>
    to the head section, this doesn't appear to have broken anything, though I don't know how to go about employing this in my script call on the page body.

    Could anyone help at all?

  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

    Use this instead of Step 1 from the demo page:

    Code:
    <script type="text/javascript" src="http://www.mysite.com/myimages/getalbumpics.php?id=myvacation"></script>
    
    <script type="text/javascript">
    (function(av){
    	var re = /\.[^\.]*/, avi = av.images, i = avi.length - 2;
    	for (i; i > -1; --i){
    		av.desc[i] = avi[i][1].replace(re, '');
    	}
    })(myvacation);
    </script>
    
    <script type="text/javascript" src="ddphpalbum.js">
    
    /***********************************************
    * PHP Photo Album script v2.0- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
    ***********************************************/
    
    </script>
    
    <link rel="stylesheet" type="text/css" href="ddphpalbum.css" />
    If you use the same (highlighted and red) variable for both the getalbumpics.php?id and in the function, the script will take care of the rest. Just install the rest of the script as you normally would.

    If you want more help:

    Please post a link to a page on your site that contains the problematic code so we can check it out.
    Last edited by jscheuer1; 12-13-2010 at 06:53 PM. Reason: add detail
    - 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
  •