SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2002
    Location
    Houston, Texas, USA
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    HELP - Dynamic Thumbnail Images

    What PHP code do I put in a HTML/php page to tell the browser to display a thumbnail image on the fly?

    For example, when someone clicks a link such as Select This, this link will take them to another page which will display a THUMBNAIL IMAGE of their selection from the prior page.

    Can anyone help me with this?

  2. #2
    That's Right. notepad_coder's Avatar
    Join Date
    Apr 2002
    Location
    Colorado
    Posts
    835
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can make a function for it like:
    PHP Code:
    <?
    function tnImage($images) {
        echo 
    "<a href='" .$image"' target='_blank'>" .
        
    "<img src='" .$image"' width=100 height=100>" .
        
    "</a>";
    }
    tnImage($_GET['imageName']);
    ?>
    And that will make $_GET['imageName'] a thumbnail to the image.
    - the lid is off the maple syrup again!

  3. #3
    gingham dress, army boots... silver trophy redux's Avatar
    Join Date
    Apr 2002
    Location
    Salford / Manchester / UK
    Posts
    4,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...bearing in mind that notepad's example doesn't actually create a thumbnail-sized new graphic, but just instructs the browser to display the graphic at a predetermined size. the downside of this is of course that the image needs to be loaded by the browser anyway (so if you have a 2 MB image, the thumbnail will be 2 MB as well...just that the browser will do its best to display it as 100x100 or whatever).
    there are libraries that can actually do image conversion/resizing/creation etc...but their name s escapes me... is it GDLib and something else ?
    re·dux (adj.): brought back; returned. used postpositively
    [latin : re-, re- + dux, leader; see duke.]
    WaSP Accessibility Task Force Member
    splintered.co.uk | photographia.co.uk | redux.deviantart.com

  4. #4
    That's Right. notepad_coder's Avatar
    Join Date
    Apr 2002
    Location
    Colorado
    Posts
    835
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yea that's true. I think it's:
    PHP Code:
    imagecopyresized(dst_imsrc_imdstXdstYsrcXsrcYdstWdstHsrcWsrcH); 
    But I'm not sure. I think www.phpbuilder.net has script for it.

    Here is a class to make thumbnails http://www.sloppycode.net/sloppycode/PHP/cm18.html
    Last edited by notepad_coder; May 20, 2002 at 09:39.
    - the lid is off the maple syrup again!

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2002
    Location
    Houston, Texas, USA
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the input. But I'm still lost here. (I'm a beginner, so please excuse me)

    Let me demonstrate what I am trying to do here.

    On this page, people select a design
    http://www.7designavenue.com/webexpress/thumbs.htm

    They end up on this page after selecting the design and this page has the PHP code which tells the design number they selected as well as the price of the design.
    http://www.7designavenue.com/webexpress/order.php

    I want the thumbnail images that are on this page http://www.7designavenue.com/webexpress/thumbs.htm to show up on the .../order.php page, just like the Design No. and Price is showing up.

    The code to show the price and design no is
    ../order.php?price=$599.00&design=AC001

    How do I hook up the thumbnail, eg. ac001.jpg? to it can show up on ../order.php when a respective design is selected?

    I'll get this soon ... trust me!


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
  •