" "){ //GET FILE NAME TO DELETE $SelectStr = "SELECT * FROM photos where User_ID = '" . $_SESSION['sessionUserID'] . "' AND ID = '" . $_REQUEST['picID'] . "' "; $result = MySQL($dbName,$SelectStr) or die(mysql_error()); IF($myrow=MySQL_fetch_array($result)){ $image = $myrow["Image"]; unlink("userPhotos/images/" . $image); unlink("userPhotos/tiny/" . $image); unlink("userPhotos/thumbnails/" . $image); $sql = "DELETE FROM photos WHERE User_ID = '" . $_SESSION['sessionUserID'] . "' AND ID = '" . $_REQUEST['picID'] . "' "; $result = MySQL($dbName,$sql) or die(mysql_error()); } } //**** end of delete a photo //see if looking at friends id if($_REQUEST['fid'] > " " ){ $userID = $_REQUEST['fid']; //MAKE SURE THIS USER IS SUPPOSED TO SEE THIS $SelectStr = "select * from privacy where (privacy.deleted = 0) AND ((privacy.user_id = '" . $_REQUEST['fid'] . "') and (privacy.friend_id = '" . $_SESSION["sessionUserID"] . "') and (photo = 'Y') )"; $result = mysql_query($SelectStr) or die(mysql_error()); if($myrow=MySQL_fetch_array($result)){ $SelectStr = "SELECT count(*) as thecount FROM photos where User_ID = '" . $_REQUEST['fid'] . "' "; $friendok = 'y'; }else{ $SelectStr = "SELECT count(*) as thecount FROM photos where User_ID = '" . $_SESSION["sessionUserID"] . "' "; } }else{ $SelectStr = "SELECT count(*) as thecount FROM photos where User_ID = '" . $_SESSION["sessionUserID"] . "' "; } //get number of pics in the user's library $result1 = MySQL($dbName,$SelectStr) or die(mysql_error()); if($myrow1=MySQL_fetch_array($result1)){ $thecount = $myrow1["thecount"]; } if($thecount > 25){ unset($_FILES['Photo1']); } //*************************************************** //insert photo1 //*************************************************** if( $_FILES['Photo1']['name'] > " ") { //make sure this directory is writable! $path_thumbs = "userPhotos/thumbnails/"; //the new width of the resized image, in pixels. $img_thumb_width = 90; // $extlimit = "yes"; //Limit allowed extensions? (no for all extensions allowed) //List of allowed extensions if extlimit = yes $limitedext = array(".gif",".jpg",".png",".jpeg",".bmp", ".JPG"); //the image -> variables $file_type = $_FILES['Photo1']['type']; $file_name = $_FILES['Photo1']['name']; $file_size = $_FILES['Photo1']['size']; $file_tmp = $_FILES['Photo1']['tmp_name']; //check the file's extension $ext = strrchr($file_name,'.'); $ext = strtolower($ext); //uh-oh! the file extension is not allowed! if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "Wrong file extension.
--back"; exit(); } //so, whats the file's extension? $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; //create a random file name $rand_name_ext = md5(time()); $rand_name_ext = rand(0,999999999); $rand_name = $_SESSION['sessionUserID'] . "-" . $rand_name_ext; //the new width variable $ThumbWidth = $img_thumb_width; ///////////////////////////////// // CREATE THE THUMBNAIL // //////////////////////////////// //keep image type if($file_size){ if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){ $new_img = imagecreatefromjpeg($file_tmp); }elseif($file_type == "image/x-png" || $file_type == "image/png"){ $new_img = imagecreatefrompng($file_tmp); }elseif($file_type == "image/gif"){ $new_img = imagecreatefromgif($file_tmp); } //list the width and height and keep the height ratio. list($width, $height) = getimagesize($file_tmp); //calculate the image ratio $imgratio=$width/$height; if ($imgratio>1){ $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; }else{ $newheight = $ThumbWidth; $newwidth = $ThumbWidth*$imgratio; } //make sure the image is big enough to resize if (($newwidth > $width) || ($newheight > $height) ){ $newwidth = $width; $newheight = $height; } //function for resize image. if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); }else{ die("Error: Please make sure you have GD library ver 2+"); } //the resizing is going on here! imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //finally, save the image ImageJpeg ($resized_img,"$path_thumbs/$rand_name.$file_ext"); ImageDestroy ($resized_img); ImageDestroy ($new_img); } //make sure this directory is writable! $path_thumbs = "userPhotos/images/"; //the new width of the resized image, in pixels. $img_thumb_width = 700; // $extlimit = "yes"; //Limit allowed extensions? (no for all extensions allowed) //List of allowed extensions if extlimit = yes $limitedext = array(".gif",".jpg",".png",".jpeg",".bmp",".JPG"); //the image -> variables $file_type = $_FILES['Photo1']['type']; $file_name = $_FILES['Photo1']['name']; $file_size = $_FILES['Photo1']['size']; $file_tmp = $_FILES['Photo1']['tmp_name']; //check if you have selected a file. if(!is_uploaded_file($file_tmp)){ echo "Error: Please select a file to upload2!.
--back"; exit(); //exit the script and don't process the rest of it! } //check the file's extension $ext = strrchr($file_name,'.'); $ext = strtolower($ext); //uh-oh! the file extension is not allowed! if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "Wrong file extension.
--back"; exit(); } //so, whats the file's extension? $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; //create a random file name //$rand_name_ext = md5(time()); //$rand_name_ext = rand(0,999999999); //$rand_name = $_SESSION['sessionUserID'] . "-" . $rand_name_ext; //the new width variable $ThumbWidth = $img_thumb_width; ///////////////////////////////// // CREATE THE THUMBNAIL // //////////////////////////////// //keep image type if($file_size){ if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){ $new_img = imagecreatefromjpeg($file_tmp); }elseif($file_type == "image/x-png" || $file_type == "image/png"){ $new_img = imagecreatefrompng($file_tmp); }elseif($file_type == "image/gif"){ $new_img = imagecreatefromgif($file_tmp); } //list the width and height and keep the height ratio. list($width, $height) = getimagesize($file_tmp); //calculate the image ratio $imgratio=$width/$height; if ($imgratio>1){ $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; }else{ $newheight = $ThumbWidth; $newwidth = $ThumbWidth*$imgratio; } //make sure the image is big enough to resize if (($newwidth > $width) || ($newheight > $height) ){ $newwidth = $width; $newheight = $height; } //function for resize image. if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); }else{ die("Error: Please make sure you have GD library ver 2+"); } //the resizing is going on here! imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //finally, save the image ImageJpeg ($resized_img,"$path_thumbs/$rand_name.$file_ext"); ImageDestroy ($resized_img); ImageDestroy ($new_img); } //make sure this directory is writable! $path_thumbs = "userPhotos/tiny"; //the new width of the resized image, in pixels. $img_thumb_width = 78; // $extlimit = "yes"; //Limit allowed extensions? (no for all extensions allowed) //List of allowed extensions if extlimit = yes $limitedext = array(".gif",".jpg",".png",".jpeg",".bmp"); //the image -> variables $file_type = $_FILES['Photo1']['type']; $file_name = $_FILES['Photo1']['name']; $file_size = $_FILES['Photo1']['size']; $file_tmp = $_FILES['Photo1']['tmp_name']; //check if you have selected a file. if(!is_uploaded_file($file_tmp)){ echo "Error: Please select a file to upload2!.
--back"; exit(); //exit the script and don't process the rest of it! } //check the file's extension $ext = strrchr($file_name,'.'); $ext = strtolower($ext); //uh-oh! the file extension is not allowed! if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "Wrong file extension.
--back"; exit(); } //so, whats the file's extension? $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; //create a random file name //$rand_name_ext = md5(time()); //$rand_name_ext = rand(0,999999999); //$rand_name = $_SESSION['sessionUserID'] . "-" . $rand_name_ext; //the new width variable $ThumbWidth = $img_thumb_width; ///////////////////////////////// // CREATE THE THUMBNAIL // //////////////////////////////// //keep image type if($file_size){ if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){ $new_img = imagecreatefromjpeg($file_tmp); }elseif($file_type == "image/x-png" || $file_type == "image/png"){ $new_img = imagecreatefrompng($file_tmp); }elseif($file_type == "image/gif"){ $new_img = imagecreatefromgif($file_tmp); } //list the width and height and keep the height ratio. list($width, $height) = getimagesize($file_tmp); //calculate the image ratio $imgratio=$width/$height; if ($imgratio>1){ $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; }else{ $newheight = $ThumbWidth; $newwidth = $ThumbWidth*$imgratio; } //make sure the image is big enough to resize if (($newwidth > $width) || ($newheight > $height) ){ $newwidth = $width; $newheight = $height; } //function for resize image. if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); }else{ die("Error: Please make sure you have GD library ver 2+"); } //the resizing is going on here! imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //finally, save the image ImageJpeg ($resized_img,"$path_thumbs/$rand_name.$file_ext"); ImageDestroy ($resized_img); ImageDestroy ($new_img); } $sql = "INSERT INTO photos (User_ID, Image, Caption) values ( '" . $_SESSION['sessionUserID'] . "', '$rand_name.$file_ext', '" . $_REQUEST['Caption1'] . "')"; $result = MySQL($dbName,$sql) or die(mysql_error()); } //end of photo1 ?> Yada Home
yada home
my fridge
   
"y"){?>
   ADD NEW PHOTO  
   My photos currently allows 24 photos to be uploaded.    
     
 
"y"){ ?>
 



 


"; ?> ";}?>
<?= $caption ?>
 
";$counter = 1;} ?>
); background-position:center;">
" class="bottomLinksHeadlines">delete
share photo album