}
         // UPLOAD Avatar
         if ($_FILES['avatarFile']['name'] != "") {
             $ext = substr($_FILES['avatarFile']['name'], -3);
             //$avFileName = "av".time().".$ext";
             $avFileName = "av-" . $id . ".{$ext}";
             upload_file_new($_FILES['avatarFile'], $avFileName, "../gal_images/");
             if ($file_result_code == 1) {
                 $sql = "UPDATE photo_galleries SET link='{$file_details['1']}' WHERE id = '{$item_id}'";
                 $result = mysql_query($sql);
             }
         }
     }
     // UPLOAD IMAGE
     if ($image != "") {
         upload_image_g($image, $image_name, $image_type, $image_path, "", "", "125", "95");
         // returns $image_details[1] - $image_details[8]
         // new image name(1),image type(2), image path(3), image bytes(4), image kb(5), width(6), heigth(7), time(8)
         // $image_results returns results of upload
         // $result_code returns 1,2,3 / results of upload... 1 Success, 2 Type Not Supported , 3 Empty
         if ($result_code == 1) {
             $added = date("Ymd");
             $sql = "INSERT INTO uploaded_images (reference,reference_id,filename,photo_title,keywords,price,added) VALUES ('{$reference}','{$item_id}','{$image_details['1']}','{$photo_title}','{$keywords}','{$price}','{$added}')";
             $result = mysql_query($sql);
         }
     }
     header("location: " . $_POST['return'] . '&lang=' . $_POST['language']);
     break;
     /* DELETE IMAGE */
 /* DELETE IMAGE */
 case "delete_image":
 $price = price_cleanup($price);
 //SAVE DATA
 $publish_date = $s_year . $s_month . $s_day;
 $sql = "UPDATE photo_package SET title='{$title}',gallery_id='{$gallery_id}',keywords='{$keywords}',active='{$active}',added='{$added}',photographer='{$photographer}',description='{$description}',prod='{$prod}',sizes='{$size}',update_29='1',all_prints='{$all_prints}',all_sizes='{$all_sizes}',other_galleries='{$other_galleries2}',act_download='{$act_download}',featured='{$featured}' WHERE id = '" . $_POST['item_id'] . "'";
 $result = mysql_query($sql);
 // UPLOAD FILE
 if ($fileup != "") {
     upload_file($fileup, $fileup_name, $file_path);
     if ($file_result_code == 1) {
         $sql = "INSERT INTO uploaded_files (reference,reference_id,filename,file_text) VALUES ('{$reference}','{$item_id}','{$file_details['1']}','{$file_text}')";
         $result = mysql_query($sql);
     }
 }
 // UPLOAD IMAGE
 if ($_FILES['image'] != "") {
     upload_image_g($_FILES['image'], $_FILES['image']['name'], $_FILES['image']['type'], $image_path, "", "", "125", "100");
     // returns $image_details[1] - $image_details[8]
     // new image name(1),image type(2), image path(3), image bytes(4), image kb(5), width(6), heigth(7), time(8)
     // $image_results returns results of upload
     // $result_code returns 1,2,3 / results of upload... 1 Success, 2 Type Not Supported , 3 Empty
     if ($result_code == 1) {
         $added = date("Ymd");
         $sql = "INSERT INTO uploaded_images (reference,reference_id,filename,price,quality,quality_order,added,price_contact) VALUES ('{$reference}','{$item_id}','{$image_details['1']}','{$price}','{$quality}','{$quality_order}','{$added}','{$price_contact}')";
         $result = mysql_query($sql);
     }
 }
 header("location: " . $_POST['return']);
 break;
 /*-----------------------------------------------------------------------------------------------------------------------*/
 /*                                                      DEFAULT                                                          */
 /*-----------------------------------------------------------------------------------------------------------------------*/