Results 1 to 5 of 5

Thread: Print Image in an imageholder

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

    Default Print Image in an imageholder

    Hi all. New to the forum.... I checked it out early this morning and liked the stuff you guys have. So i thought i would check with you about my problem.

    First off. I'm just learning css and xhtml so this is a learning experience.

    So here is my challenge. I making a site with 1000s of images. I would like to make a template for all my pages that will hold one image each. So there will be 100s if not 1000s of such pages. So what i'm trying to do is create a script that will print what ever image is inside an image holder called "Main Image" I would like to place a button on each page that when pressed will print what ever image is in the image holder, I think it's technically called an image place holder.

    Well I hope that makes sense. I'm also trying to do the same thing for an email and bookmark button. Thanks for your time.

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Well, you can do it with CSS... in a way. Using the @media parameter, basically you take all the content you have on the page and set it to display: none, leaving only the Main image content visible. Like so:

    Code:
    # @media print
    # {
    # body{font-family:georgia,times,sans-serif;}
    # #left{display:none;}
    # #center{display:none;}
    # #right{display:none;}
    # #Main_Image{display:block;}
    # }
    #
    # @media screen
    # {
    # body{font-family:arial,verdana,sans-serif;}
    # #left{display:block;margin:20px;}
    # #center{display:block;margin:20px;}
    # #right{display:block;margin:20px;}
    # #Main_Image{display:block;margin:20px;}
    # }
    The above assumes you have 4 ID's on your page, "left", "center", "right" and "Main Image". When the print button is pressed, the printer "sees" only the "Main Image" div (table, whatever) and that's all it prints.
    Last edited by BLiZZaRD; 03-18-2010 at 11:40 PM.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Mar 2010
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    wow, cool.

    Now does that make it so the image or only visable item is scaled up or down to fit the print media?

    Thanks, I will play with that and see how it goes. I'll let everyone know

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    I don't use it, so your test will tell you more than I can. However, the code suggest that everything stays size oriented. the printer actually IS printing all items on the page, as far as the printer is concerned. The thing is that everything except what you don't want printed is "invisible" to the printer, so no ink is being put on the paper in that spot.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

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

    cyote101 (03-20-2010)

  6. #5
    Join Date
    Mar 2010
    Posts
    10
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your info,

    is it not possible to print just a div or something?

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
  •