Results 1 to 6 of 6

Thread: Simple Controls Gallery image link

  1. #1
    Join Date
    Feb 2011
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Simple Controls Gallery image link

    1) Script Title: Simple Controls Gallery

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

    3) Describe problem: I have embedded the script in this page:www.17minutes.f2s.com/Gallery2.htm
    I understand that the images can be hyperlinked. i would like to use this facility to open a new window with the relevant clicked image in for printing. I have tried to call a function I have written before:
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    function BigPhoto(source){
      var source
      var newWindow = window.open("", "", 
            "location=no, directories=no, fullscreen=no, menubar=no, status=no, toolbar=no, width=900, height=600, scrollbars=no");
      	newWindow.document.write("<BODY BGCOLOR=#000000 LINK=#FFFFFF>");
    	newWindow.document.write("<center>");
    	newWindow.document.write("<a = 'javascript:window.refresh()'></a>")
        newWindow.document.write("<img src='" + source + "'/><br>");
    	newWindow.document.write("</body></html>");
        newWindow.document.print();
    	newWindow.document.close();
    }
    
    </SCRIPT>
    but I don't know how to code calling the function and passing the "source" parameter to the function.
    Another option would be to make a new page, say called PrintImage, and link to it from the image and define it's source as part of the link so the page opens to display the image for printing.

    Any thoughts please, my heads spinning!

    Cheers, Lol

  2. #2
    Join Date
    Feb 2011
    Posts
    15
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    This will open the image once clicked in a new window
    Example
    <a href="./images/002.jpg" target="_blank"><img src="images/img002.jpg" id="Image1" alt="" border="0" style="width:603px;height:369px;"></a>

  3. #3
    Join Date
    Feb 2011
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Hi, the problem I have is that the hyperlink is enclosed in quotes as part of the image gallery source code and is either, say, PrintImage.htm for a local page or http:// etc for an external one. trying to add other information such as an img src just stalls the gallery altogether. tricky,no?

  4. #4
    Join Date
    Oct 2009
    Posts
    845
    Thanks
    14
    Thanked 189 Times in 188 Posts

    Default

    well, I'm not sure I understand your requirements correctly, but maybe you could make the imagaarray like this:

    ["Samurai/001.jpg", "http://www.17minutes.f2s.com/Samurai/001.jpg", "_new", ""],

  5. #5
    Join Date
    Feb 2011
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    azoomer that worked brilliantly! This is what I have been banging my head against the wall with. Now, if I could somehow format the new page i.e change background colour, centre image. Also, it would be useful for it to call the print command on bodyload and then printwindow.
    I have come up with a rudimentary solution by assigning a page to EVERY image. This is okay, but there could be 300 images! This is the code I have used in the page I have created so far and it works great, clicking on the first image in the gallery www.17minutes.f2s.com/Gallery4.htm brings up a new page, asks for print permission and then on a timer closes down returning to the original flash gallery
    Code:
    <body onLoad="window.print()">
    <script type="text/javascript" language="javascript">
    
       
        {
    		setTimeout("history.go(-1)",10000);
    
        }
        
        </script>
    As I said, being able to create the page dynamically would be brilliant.
    Cheers, Lol

  6. #6
    Join Date
    Feb 2011
    Posts
    17
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Right I've looked into the source file, simplegallery.js, and identified the array code and how it handles the images in terms of links etc
    element[0] is the source to view
    element[1] is the link address for any hyperlinking
    element[2] is the target
    element[3] is for any sort of text

    the actual code is:
    Code:
    simpleGallery.routines={
    
    	getSlideHTML:function(imgelement){
    		var layerHTML=(imgelement[1])? '<a href="'+imgelement[1]+'" target="'+imgelement[2]+'">\n' : '' //hyperlink slide?
    		layerHTML+='<img src="'+imgelement[0]+'" style="border-width:0" />'
    		layerHTML+=(imgelement[1])? '</a>' : ''
    		return layerHTML //return HTML for this layer
    	},
    In the array in my webpage I would like to leave element[0] as it is, typically "001.jpg"
    Set element[1] to "PrintImage.htm" with it's image source set to "Large/"+element[0] - a larger version of "001.jpg".

    I can't do javascript so would appreciate some help to code this properly if possible?
    Thanks, Lol

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
  •