What Is It?

The Everything2 People Picture Directory is a utility that lets you browse through e2 users by the images presented on their homenode. Note that you have to be eligible to have a homenode picture before being included (i.e., acquiring level 6 or being otherwise ordained by the Gods).

It was written because I wanted to see all of the homenode images at once and be able to quickly and easily visit the homenodes of those users with interesting pictures.

Where Is It?

The utility currently does not have a home. If you are able to host the page, please send me a /msg so that I can add the URL here.

The Source Code

Here is the complete source code with comments. This is public domain, take and do with it what you wish.

<?PHP

// basic image size variable; feel free to change this if you want
  $width = 150;

// The number of images per row
  $images_per_row = 4;

// width of cell
  $factor = 100 / $images_per_row;

// location of the page that lists all of the images
  $url = "http://everything2.com/images/userincoming";

// open the file, blow through the first couple of lines
  $file = fopen($url,"r");
  $string = fgets($file,1024); // DOCTYPE line
  $string = fgets($file,1024); // continued
  $string = fgets($file,1024); // HTML open tag
  $string = fgets($file,1024); // HEAD open tag
  $string = fgets($file,1024); // TITLE
  $string = fgets($file,1024); // HEAD close tag
  $string = fgets($file,1024); // BODY open tag
  $string = fgets($file,1024); // blank line
  $string = fgets($file,1024); // TABLE,TR,TD open tag
  $string = fgets($file,1024); // FONT open tag
  $string = fgets($file,1024); // Text
  $string = fgets($file,1024); // blank line
  $string = fgets($file,1024); // column headers
  $string = fgets($file,1024); // HR
  $string = fgets($file,1024); // Parent Directory URL

// and now display a cute page header

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>Everything2 Image Browser</title>
</head>
<body>
<h1>Everything2 Users... In POG Form!</h1>

<p>Click on a picture to see the larger image.<br>
Click on a username to visit that user's homenode.</p>

<table width="100%">
<?

// keep track of the number of users processed

  $count_of_users_processed = 0;

// Now we're down to the listing of users

// get the first user
  $string = fgets($file,1024);

// now, while there are still more users...
  while(substr_count($string,"hr noshade") < 1)
  {

// trim off useless piece of string
    $string = substr($string,62);

// extract name of image
    $image_name = strtok($string,"\"");

// extract username
    $user_name = strtok($string,".");

// if we're at the start of the table...
    if($count_of_users_processed == 0)
    {
?>
<tr>
<?
    }

// or else we're at the start of a row
    else if(($count_of_users_processed % $images_per_row) == 0)
    {
?>
</tr><tr>
<?
    }

// now, display that image!
    echo "<td width=\"" . $factor . "\" align=\"center\">"
          . "<a href=\"http://everything2.com/images/userincoming/"
          . $image_name . "\"><img width=\"" . $width 
          . "\" border=0 src=\"http://everything2.com/images/userincoming/"
          . $image_name . "\"></a><br><b>"
          . "<a href=\"http://everything2.com/index.pl?node=" . $user_name
          . "\">" . $user_name . "</a></b></td>";

// get a new one, increment the count
    $string = fgets($file,1024);
    $count_of_users_processed++;
  }

?>
</table>
</body>
</html>

Why?

It was basically written as very simple practice in using some of the string manipulation functions in PHP. I tend to try to write things that are of some real application when practicing, and this is the result.

Log in or registerto write something here or to contact authors.