WEB thumbnail view v.php

Discussion in 'OT Technology' started by DillDoe, May 30, 2008.

  1. DillDoe

    DillDoe Feels good mang

    Joined:
    Jan 16, 2004
    Messages:
    62,315
    Likes Received:
    46
    Location:
    dilldoe.organ
    Anyone got a simple php script which will take images from a local drive and generate thumbnail page.

    I want to organize my nds roms with their cover art, so just want a simple php to display X amount on a page with links to their roms.
     
  2. retorq

    retorq What up bitch??

    Joined:
    Dec 14, 2006
    Messages:
    6,061
    Likes Received:
    0
    Location:
    Mohave Desert
    Pulls the folder and filename from a database table and dynamically creates the thumbnail on the fly, thumbs get dumped every 10 mins with a cron script.

    Are you looking for dynamic or static thumbs?? Static is easy, get picture resizer power tool from MS, select all, right click, resize, go 150x150, resize orig, make smaller not bigger and there you have it.

    Code:
    //
    // Building thumbnail and link
    //
    list($x, $y) = getimagesize("$file");
    
            if($x > $y){
               $max = $x;
               $min = $y;
            }
            if($x <= $y){
               $max = $y;
               $min = $x;
            }
    
        $new_max_size = '205';
    
        $rate = $max/$new_max_size;
        $final_x = $x/$rate;
        $final_y = $y/$rate;
    
        if($final_x > $x) {
                $final_x = $x;
                $final_y = $y;
        }
    
        $final_x = ceil($final_x);
        $final_y = ceil($final_y);
    
    $image_p = imagecreatetruecolor($final_x, $final_y);
    $new_image = imagecreatefromjpeg($file);
    @imagecopyresampled($image_p, $new_image, 0, 0, 0, 0, $final_x, $final_y, $x, $y);
    imagejpeg($image_p, "tmp/$filename", 50);
    $random_pic = '<a href="'.$file.'" rel="lightbox" target="_blank"><img width="205" alt="RANDOM PIC" src="tmp/'.$filename.'"></a>';
    
     
  3. Jesse

    Jesse PSN: iamajesse; XBL: Inhale My Rod; G8 GT crew; Ne OT Supporter

    Joined:
    Jan 12, 2005
    Messages:
    25,649
    Likes Received:
    0
    Location:
    California :: (925)
  4. Browning

    Browning Active Member

    Joined:
    Feb 14, 2005
    Messages:
    89,463
    Likes Received:
    10

Share This Page