SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Image display script

    I was always puzzled at how some sites can use one script as the src for the images, and it will pull it from a database of information on what file it needs and how to access it.

    what my question is how you can do this

    PHP Code:
    <img src="image.php?imgid=29023"
    and have it return and image in a certain folder, but still hav that if you view the source. I have fried fopen, but that doesnt work. I havent found much on the subject, so I thought I would ask. If you want to see the code for finding it, here is a sample.

    PHP Code:
    if ( isset($imgid) ) {
        
    $imginfos=$DBO->query_first("SELECT sku FROM items WHERE sku='$imgid'");
        
    $imginfo=$imginfos[sku];
        
    // readfile("$imginfo");
        
    @fopen ("/home/store/stock/".$imginfo.".gif""rb");
    } else {
        @
    fopen ("/home/store/stock/blank.gif""rb");

    as you can see I also tried readfile, but I am not too sure on how to use it.
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer

  2. #2
    Talk to the /dev/null Theiggsta's Avatar
    Join Date
    Mar 2001
    Location
    Tampa, FL
    Posts
    376
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried out readfile() and used the fopen parameters, aparently it worked!

    great how you figure things out like that
    Aaron "Theiggsta" Kalin
    Pixel Martini
    Ruby and Rails Developer


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
  •