[wplug] Picture to web management tool?

Russ Schneider russ at sugapablo.com
Wed Feb 4 10:37:57 EST 2004


On Wed, 4 Feb 2004, Vanco, Don wrote:

> Does anyone have any experience with a tool that allows you to easily
> catalog images for posting to a website? 

Don't know how robust a thing you need.  I just wrote myself a very simple
script that would read a directory ("/home/www/photos" in this case) on my
server.  Any photo I would upload to that directory, would be listed on
the page so you could click and view it in it's own page (same .php page 
actually).

You might want more, I didn't bother messing with thumbnails, but it sure 
is simple and easy to use.

http://www.sugapablo.net/photos.php  <-- you can see it here.

code:
------------------------------------------------------------------------
echo "<P><B>[- Photos -]</b></P>";
 
if(empty($_GET['id'])) {
        echo "
                <table class=\"sub\">
                <tr>
                        <td class=\"menu\"><b>Filename</b></td>
                        <td class=\"menu\"><b>Filesize</b></td>
                        <td class=\"menu\"><b>Last Modified</b></td>
                </tr>";
 
        $dirTmp = opendir('photos');
                while(false !== ($file = readdir($dirTmp))) {
                        $pos = strpos($file, ".");
                        if($file != "." && $file != ".." && $pos != 0) {
                                echo "<tr><td class=\"body\"><a 
href=\"photos.php?id=".$file."\">".$file."</a></td>";
                                $size = 
round(filesize("/home/www/photos/".$file) / 1000);
                                echo "<td class=\"body\">".$size." 
KB</td>";
                                echo "<td class=\"body\">".date ("F d Y 
H:i:s.", filemtime("/home/www/photos/".$file))."</td></tr>";
                        }
                }
        closedir($dirTmp);
 
        echo "</table>";
 
include("includes/bottom.php");
}
 
else {
        echo "<div class=\"center\">
                <img src=\"photos/".$_GET['id']."\" alt=\"photo\">
                <P>[- <a href=\"photos.php\">back</a> -]</P>
                </div>";
}

-- 
[ Russ Schneider (a.k.a. Sugapablo)     ]
[ http://www.sugapablo.com <--music     ]
[ http://www.sugapablo.net <--personal  ]
[ sugapablo at 12jabber.com   <--jabber IM ]



More information about the wplug mailing list