puddin 0 Junior Poster in Training

I have tried and again I cannot figure it out. Everything is working...

Only the jpg, JEPG like these do not show up correctly... Can you see the mistake? If you do please spell it out for me. Much appreciated, again, puddin.

Here is my form and process photo code:

_________________________
THIS IS THE FORM
_________________________

<?php
include 'db.php';

// initialization
  $photo_upload['aphoto_filename'];
  $counter = 1;

if( $_GET['number_of_fields'] )
$number_of_fields = (int)($_GET['number_of_fields']);


// Lets build the Photo Uploading fields
while( $counter <= $number_of_fields )
{
$photo_upload;

__HTML_END;
$counter++;
}
// Final Output
echo <<<__HTML_END

<!-Insert the photo fields here -->
$photo_upload
<html>
<head>
<title>Lets upload Photos</title>
</head>

<body>
<table class="image" cellpadding="1" cellspacing="0">
<tr>
<td> 
<form name="photo_filename" action="photo1.php" method="post" enctype="multipart/form-data">
<font color=#FFFFFF><b> 
Photo: 
<input name="aphoto_filename[]" type="file">
Caption: <textarea name='namea' cols='20' rows='1'></textarea>
<input type='submit' name='submit' value='Add Photos'/>
<input type="HIDDEN" name="$session_name"  value="$session_id"></font>
</form>
</td>
</tr>
</table>
</body>
</html>
__HTML_END;
?>

________________________________________________________
THIS IS IT'S 2nd PAGE PROCESS THAT STORE'S IT AND DISPLAYS
________________________________________________________

<?php
  include 'db.php';

  // initialization
  $result_final = "";
  $counter = 0;
  // List of our known photo types
  $known_photo_types = array( 
          'image/pjpeg'=>"jpg",
          'image/jpeg'=>"jpg",
          'image/jpg'=>"jpg",
          'image/png'=>"png",
          'image/x-png'=>"png",
          'image/gif'=>"gif",
          'image/bmp'=>"bmp"
         );

  // GD Function List
  $gd_function_suffix = array( 
            'image/pjpeg' => 'JPEG',
            'image/jpeg' => 'JPEG',
            'image/gif' => 'GIF',
            'image/bmp' => 'WBMP',
            'image/x-png' => 'PNG'
          );
   // Fetch the photo array sent by preuploads.php
  $photos_uploaded = $_FILES['aphoto_filename']; 


  // Fetch the photo caption array
  $_POST['namea'];

   while( $counter <= count($photos_uploaded) )
  {

   if($photos_uploaded['size'][$counter] > 0)
    {
      if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types))
       {      
        $result_final .= "File ".($counter+1)." is not a photo<br />";

       }else{

      // get the variables from home page
      $password = $_SESSION['password'];  
      $email_address = $_SESSION['email_address'];

        $sql_update = mysql_query("UPDATE myd SET aphoto_filename='".($filename)."', 
        namea='".($namea)."' WHERE email_address='".($email_address)."' AND password='".($password)."'" );
        $filetype = $photos_uploaded['type'][$counter];
        $extention = $known_photo_types[$filetype];
        $filename = $namea.".".$extention;         


        $sql_update = mysql_query("UPDATE myd SET aphoto_filename='".($filename)."', 
        namea='".($namea)."' WHERE email_address='".($email_address)."' AND password='".($password)."'" );

        $sql_check_num = mysql_num_rows($sql_check); 
        if($sql_check_num == 0){ 

        echo ("");
      } else {
        echo ("");
      }       
       // Store the orignal file
        copy($photos_uploaded['tmp_name'][$counter], $images_dir."/$name_".$filename );

        // Let's get the Thumbnail size
        $size = GetImageSize( $images_dir."/".$filename );
        if($size[0] > $size[1])
        {
          $thumbnail_width = 100;
          $thumbnail_height = (int)(100 * $size[1] / $size[0]);
        }

        else
        {

          $thumbnail_width = (int)(100 * $size[0] / $size[1]);
          $thumbnail_height = 100;
        }

        // Build Thumbnail with GD 1.x.x, you can use the other described methods too
        $function_suffix = $gd_function_suffix[$filetype];
        $function_to_read = "ImageCreateFrom".$function_suffix;
        $function_to_write = "Image".$function_suffix;

        // Read the source file
        $source_handle = $function_to_read ( $images_dir."/$name_".$filename );

        if($source_handle)
        {
          // Let's create an blank image for the thumbnail
               $destination_handle = ImageCreate ( $thumbnail_width, $thumbnail_height );

          // Now we resize it
        ImageCopyResized( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, 


        $thumbnail_height, $size[0], $size[1] );
        }

        // Let's save the thumbnail
        $function_to_write( $destination_handle, $images_dir."/$name_".$filename );


         $result_final .= "<img src='".$images_dir. "/$name_".$filename."' /> <br 

/>&nbsp;&nbsp; Photo ".($counter+1)."  ";
      }
    }
  $counter++;
  }

 echo <<<__HTML_END

<html>
<head>
  <title>Photos uploaded</title>
</head>
<body>

     $result_final
</font>
</body>
</html>
__HTML_END;
?>
</p>

Gifs come up perfect but not JPEGS, Please I Am NEW At PHP CLEAR CODE INSTRUCTION IS REALLY APPRECIATED, Thanks soooo Much, puddin!