$fname = $_FILES["newPhotos"]["name"][$key]; $imgType = ["image/jpg", "image/jpeg", "image/png", "image/gif"]; if (!is_dir(CAROUSEL)) { mkdir(CAROUSEL, 0755, true); } if (!is_dir(BIMG)) { mkdir(BIMG, 0755, true); } $photoFileOP->fileDestination = BIMG; $size = $_FILES["newPhotos"]["size"][$key]; // $MAX_FSIZE = (int)(ini_get('upload_max_filesize'))."000000"; if (in_array($_FILES["newPhotos"]["type"][$key], $imgType)) { if ($size < 5000000) { if ($fileC < 5) { $fileC++; if ($photoFileOP->fileUpload($_FILES["newPhotos"]['tmp_name'][$key], $_FILES['newPhotos']['name'][$key])) { // set the standard resize photos if ($photoFileOP->fileResizeUploadedImage("", $photoFileOP->fileDestinationAndName)) { //insert big file here $photoFileOP->setRquery("INSERT INTO amistiTemp VALUES(?,?,?,?)", array('', $_SESSION['userID'], $photoFileOP->newFileName, "")); $realID = $photoFileOP->getLastInsertId(); //$photoFileOP->fileDestination =CAROUSEL; $photoFileOP->genricResizeUploadedImage(170, 170, CAROUSEL, $photoFileOP->fileDestinationAndName); // resize to small image //****UPDATE BY HEEPING THE LAST INSERT ID****/ if ($photoFileOP->setRquery("UPDATE amistiTemp SET tempSmallPath=? WHERE tempID=? AND userID=?", array($photoFileOP->fileDestinationAndName, $realID, $_SESSION['userID']))) { list($x, $y) = getimagesize($photoFileOP->fileDestinationAndName); ?> <div id ="upImg_<?php echo $realID; ?>
} } } //FILE UPLOAD TO TEMP HERE if ($_FILES) { $fname = $_FILES["pUpload"]["name"]; $imgType = ["image/jpg", "image/jpeg", "image/png", "image/gif"]; if (!is_dir(CAROUSEL)) { mkdir(CAROUSEL, 0755, true); } if (!is_dir(BIMG)) { mkdir(BIMG, 0755, true); } $fOp->fileDestination = BIMG; if (in_array($_FILES["pUpload"]["type"], $imgType)) { if ($fOp->fileUpload($_FILES['pUpload']['tmp_name'], $_FILES['pUpload']['name'])) { // set the standard resize photos $fOp->fileResizeUploadedImage("", $fOp->fileDestinationAndName); //insert big file here $fOp->setRquery("INSERT INTO amistiTemp VALUES(?,?,?,?)", array('', $_SESSION['userID'], $fOp->newFileName, "")); $realID = $fOp->getLastInsertId(); //$fOp->fileDestination =CAROUSEL; $fOp->genricResizeUploadedImage(180, 180, CAROUSEL, $fOp->fileDestinationAndName); // resize to small image if ($fOp->setRquery("UPDATE amistiTemp SET tempSmallPath=? WHERE tempID=? AND userID=?", array($fOp->fileDestinationAndName, $realID, $_SESSION['userID']))) { //****UPDATE BY HEEPING THE LAST INSERT ID*******************/ $res = ["eType" => 0, "data" => "\n\t <div class='postPreviewShow' id='pDel_" . $realID . "'\n style='background-image: url(" . getImgPath($fOp->fileDestinationAndName) . ")'>\n\t\t\t <div class='postPreviewDelete' title='Delete' id='dDel_" . $realID . "' ></div>\n\t\t\t </div> "]; $res = json_encode($res); //echo $res; echo "passed"; }