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

Thread: PHP Photo Album script adding info

  1. #1
    Join Date
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Photo Album script adding info

    i have found the post to change the title from photo to the acual image name but i was wondering if it was possable to get it to display an img tag and the acual address of the image in the title for eg: like this
    Code:
    [ IMG]http://www.mysite.com/gallery/photo1.gif[/IMG ]
    like what photobucket has, it gives you the img tags and the complete address so all you do is copy and paste the link. i had to put the spaces in the img tags to get them to show as they was trying to display an image.

    i have got it to display it all except the img tags as i do not know how to put them into the script without it erroring
    Last edited by robertaussie; 03-03-2008 at 06:57 PM.

  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

    I'm not sure what you are talking about. But the information is contained in the script and can be made to appear various places. It seems to me that you are editing the buildimage function. If so, what do you have so far? If not, just what post are you referring to, and what have you done?

    Also:

    Please post a link to the page on your site that contains the problematic code 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
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    here is the part of the code i have changed the part in red is what i have altered

    Code:
    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+=imagepath+galleryarray [i][0];
    return tempcontainer
    }
    so it displays the full image address like http:///www.mysite.com/gallery/image1.gif but what i am after is how would i get it to dispaly the img tags in it at the start and end of the display like in this pic. like you can display image tages in the forum if you use the open and close img tages with the brackets that is what i want to display on the screen with the full address so all you have to do is copy and past the address with the img tags enclosed with it so you do not have to add them
    Last edited by robertaussie; 03-04-2008 at 08:11 AM.

  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

    OK, looks like (from your attached image) you want it to display both the raw path and filename as well as this pseudo tagged path and filename below that. Change:

    Code:
    tempcontainer+=imagepath+galleryarray [i][0];
    to:

    Code:
    tempcontainer+=imagepath+galleryarray [i][0]+'<br>[img]'+imagepath+galleryarray [i][0]+'[\/img]';
    Or, as it looks like you might want a little extra space between the two:

    Code:
    tempcontainer+=imagepath+galleryarray [i][0]+'<div style="margin-top:1ex;text-align:center;">[img]'+imagepath+galleryarray [i][0]+'[\/img]<\/div>';
    Or, if you want only this pseudo tagged text:

    Code:
    tempcontainer+='[img]'+imagepath+galleryarray [i][0]+'[\/img]';
    Just make sure that the .slideshow class (as well as any containing elements for it) have enough width and height to display all of this information. I believe that in the default configuration for this script, it already does.
    - John
    ________________________

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

  5. #5
    Join Date
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks a lot .. that is what i wanted .. sorry for all the confussion in asking my question but it is exactly what i wanted .

    next question is i changed it a little to do more of what i wanted and it works good except when i click the text to hightlight it i get an error when i test it.. here is the full code and the part i changed is in red and a pic is at the bottom to show the error or you can goto http://www.robleeaussie.com/pictures/ to test it .. i know i am missing something in there for the onclick but i am not sure what it is ..

    Code:
    <script src="http://www.robleeaussie.com/pictures/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="4x4" //Specify dimension of gallery (number of images shown), such as 4x2, 3x1 etc
    var imagepath="http://www.robleeaussie.com/pictures/" //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, location, resizable"]
    
    //Toggle image description: descriptionprefix[0 or 1, "Text to show" (if 1)]
    var descriptionprefix=[0, "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="http://www.robleeaussie.com/pictures/"
    
    /////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+='<div style="font-size:10" width="100"><input name="txtThumbImgTag2" id="txtThumbImgTag2" class="textBox" type="text" value="[img]'+imagepath+galleryarray [i][0]+'[\/img]" onclick="trackCodeClick(event); copyToClipboard(this);"></div>';
    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>
    Last edited by robertaussie; 03-05-2008 at 08:51 AM.

  6. #6
    Join Date
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    forgot to mention that the only thing on line 27 is </script>

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

    Quote Originally Posted by robertaussie View Post
    forgot to mention that the only thing on line 27 is </script>
    The error messages in IE often refer to the previous line. No error here in IE. I take it that you are using an older version of IE. I can tell you are by the screenshot of the error message. I just tested back through v 5. It was OK, I got errors in v 4, but it was for different lines. v 4 doesn't support this script.

    You wouldn't happen to be using a Mac?
    - John
    ________________________

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

  8. #8
    Join Date
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    no i am not on a mac i am on vista and have ie7 and sorry it was line 127 what is supose to happen is when you clcik in the box where the text is, it is supose to highlight the whole lot, but when i click in the box i get the error on the bottom left, it gives me a little yellow triangle and tells me error on page, to me i think it is looking for a close tag or something but i have tried all sorts of things but nothing seams to work.. the reason i am trying to do it that way is because the text takes up a lot of space and you only get about 3 pocs across the page because of the text, this way it is smaller and i will fit more pics across and also looks neater

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

    This is the line:

    Code:
    tempcontainer+='<div style="font-size:10" width="100"><input name="txtThumbImgTag2" id="txtThumbImgTag2" class="textBox" type="text" value="[img]'+imagepath+galleryarray [i][0]+'[\/img]" onclick="trackCodeClick(event); copyToClipboard(this);"></div>';
    trackCodeClick is not defined. I don't think you should be doing this though, you cannot copy to clipboard using client side code, except in IE and even there it can easily be blocked. When it isn't blocked, it will overwrite the user's clipboard, which can be very inconvenient at times for the user.

    You could have the data highlighted onclick to make it ready for copying, by changing:

    Code:
    onclick="trackCodeClick(event); copyToClipboard(this);"
    to:

    Code:
    onclick="this.focus();this.select();"
    - John
    ________________________

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

  10. #10
    Join Date
    Mar 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks a lot ,, that did the trick .. woohooo it works now ..

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
  •