Results 1 to 5 of 5

Thread: Getting images to print in Photo Album Script

  1. #1
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Getting images to print in Photo Album Script

    1) Script Title: Photo Album script v2.0

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

    3) Describe problem: I have used the above script to create a gallery which shows colouring pages. The user clicks on the thumbnail image which then brings up another window showing a larger version of the image. I then want the user to be able to print the larger image either on click or some other way? I have tried some javascript code but have been unable to get it to work because of the way the code is set out in this script. Can anyone help?

  2. #2
    Join Date
    Aug 2004
    Posts
    10,140
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Are you using the onphotoselect event handler and window.open() to get the enlarged image to open up in a new window when the thumbnail is clicked on? Something like:

    Code:
    thepics.onselectphoto=function(img, link){
    if (link!=null) //if this image is hyperlinked
    window.open(link.href, "", "width=800, height=600, status=1, resizable=1")
    return false //cancel default action when clicking on image, by returning false instead of true
    }
    If so, why not just tweak window.open() to show the browser's menubar within the pop up window, which gives the user easy access to printing what's inside it:

    Code:
    thepics.onselectphoto=function(img, link){
    if (link!=null) //if this image is hyperlinked
    window.open(link.href, "", "width=800, height=600, status=1, resizable=1, menubar=1")
    return false //cancel default action when clicking on image, by returning false instead of true
    }

  3. The Following User Says Thank You to ddadmin For This Useful Post:

    Devillishdeb (04-17-2008)

  4. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Well, with that window that opens up, I think that you should make it 1 html file that does all the work. With this HTML file, it will look in the location, for example:
    Image.html:
    Code:
    var allimg = new Array;
    var allimg = ["pig.png","dog.gif","jone.jpg"];
    for(i=0;i<=allimg.length-1;i++){
    if(document.URL == "http://dynamicdrive.com/?picid="+i){
    document.write('<img src="'+i+'" alt="Click on me to Print" title="Click on me to Print" onClick="window.print()" />');
    }
    }
    Now, to open that file, your gonna want to have a link on every image, in my example, as you can see in the highlighted, I have 3 images in total. One named pic.png, one named dog.gif and one named jone.jpg. To open them, on every image put:
    Code:
    onClick='window.open("image.html?picid="+this.src, "", "width=800, height=600, status=1, resizable=1")'
    I hope this helps. I havn't tested any of it yet.
    Jeremy | jfein.net

  5. The Following User Says Thank You to Nile For This Useful Post:

    Devillishdeb (04-17-2008)

  6. #4
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Thumbs up Solved thanks

    Thanks for the quick replies. Got it working using ddadmin code. I'm a relatively new coder and sorry nile but that code looked a bit complicated for me. Thanks for your help

  7. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Alright, glad to help anyway.
    Jeremy | jfein.net

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
  •