Results 1 to 7 of 7

Thread: PHP Photo Album enhancement

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

    Default PHP Photo Album enhancement

    1) Script Title: DD PHP Photo Album script

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

    3) Describe problem: increased functionality question


    Hi, I posted once before and got a great response on how to change the script to where the photo file name appears beneath the photo, which allows you to do a brief description of the photo as the file name and it appears. This seemed like a logical and simple way to get an description of the photo

    Please go to http://anne.swva.net/earrings.htm for my page in the works (note I haven't changed the file names to descriptions yet.)

    My question is this: instead of having the file name appear on the main thumbs page, can the script be altered to have the file name appear on the enabled popup window? This allows much more room and gives more white space on the thumbs page.

    THANKS in advance for help and assistance!

    - AV
    Last edited by aavaughan; 10-13-2007 at 12:31 AM.

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Warning: Please include a link to the DD script in question in your post. See this thread for the proper posting format for asking a question.

    Your link is broken. And don't post 3 threads on the same question.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

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

    Default

    link fixed.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,072
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Replace:

    Code:
    function popuplinkfunc(imgsrc){
    if (popupsetting[0]==1){
    var popwin=open(imgsrc.href, "popwin", popupsetting[1])
    popwin.focus()
    return false
    }
    else
    return true
    }
    with:

    Code:
    function popuplinkfunc(imgsrc){
    if (popupsetting[0]==1){
    var popwin=open("", "popwin", popupsetting[1]);
    popwin.document.write('<center><img src="'+imgsrc.href+'"><br>'+imgsrc.href.replace(/\.[^\.]*$/,'')+'<\/center>');
    popwin.document.close();
    popwin.focus();
    return false;
    }
    else
    return true;
    }
    Last edited by jscheuer1; 10-17-2007 at 04:53 AM. Reason: fix typo
    - John
    ________________________

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

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

    Default

    Thanks for the post John! I implemented it but ran into a couple issues I can't get around:

    - Browser issue: I tested in Firefox and IE. IE doesnt show the image, just the img src path script above the title. The photo shows fine in Firefox. I can't tell where to adjust the script to make it IE friendly.
    - I was hoping to show just the image name, not the entire URL path...is this possible? The current description has it all.

    I posted a test page at http://www.annevaughandesigns.com/imagetest.htm so you can see what is happening.

    Thanks in advance for any further help...

    AV

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,072
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    Sorry, I made a typo, leaving out a closing quote. I will correct my original post, but here it is highlighted red:

    Code:
    function popuplinkfunc(imgsrc){
    if (popupsetting[0]==1){
    var popwin=open("", "popwin", popupsetting[1]);
    popwin.document.write('<center><img src="'+imgsrc.href+'"><br>'+imgsrc.href.replace(/\.[^\.]*$/,'')+'<\/center>');
    popwin.document.close();
    popwin.focus();
    return false;
    }
    else
    return true;
    }
    This next part I won't change in my original post, but to trim the filename further, use this:

    Code:
    .replace(/^.*\/([^\/]+)\.[^\.]*$/,'$1')
    instead of:

    Code:
    .replace(/\.[^\.]*$/,'')
    So, putting it all together:

    Code:
    function popuplinkfunc(imgsrc){
    if (popupsetting[0]==1){
    var popwin=open("", "popwin", popupsetting[1]);
    popwin.document.write('<center><img src="'+imgsrc.href+'"><br>'+imgsrc.href.replace(/^.*\/([^\/]+)\.[^\.]*$/,'$1')+'<\/center>');
    popwin.document.close();
    popwin.focus();
    return false;
    }
    else
    return true;
    }
    - John
    ________________________

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

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,072
    Thanks
    44
    Thanked 3,216 Times in 3,178 Posts
    Blog Entries
    12

    Default

    I just had a thought for a little further refinement, although some browsers will still insist on showing the full path in the title bar of the pop up:

    Code:
    function popuplinkfunc(imgsrc){
    if (popupsetting[0]==1){
    var popwin=open("", "popwin", popupsetting[1]), t=imgsrc.href.split(/\/|\./); t=t[t.length-2];
    popwin.document.write('<title>'+t+'<\/title><center><img src="'+imgsrc.href+'"><br>'+t+'<\/center>');
    popwin.document.close();
    popwin.focus();
    return false;
    }
    else
    return true;
    }
    Last edited by jscheuer1; 10-17-2007 at 07:01 AM. Reason: split instead of replace
    - 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
  •