Beispiel #1
0
function delAll()
{
    $photoFileOP = new sysFilesOperations();
    $photoFileOP->setRquery("SELECT * FROM amistiTemp  WHERE userID=?", array($_SESSION['userID']));
    $fdel = $photoFileOP->getRquery();
    if (count($fdel) > 0) {
        // check if exists file in the Temp folder or DB
        for ($x = 0; $x < count($fdel); $x++) {
            $photoFileOP->fileDelete($fdel[$x]['tempBigPath']);
            //remove the file
            $photoFileOP->fileDelete($fdel[$x]['tempSmallPath']);
            //remove the file
        }
        $photoFileOP->setRquery("DELETE FROM amistiTemp  WHERE userID=?", array($_SESSION['userID']));
        //delete the file from temptable
    }
}
Beispiel #2
0
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";
            }
        }
    } else {
        $res = ["eType" => 1, "data" => $fname];
        $res = json_encode($res);
Beispiel #3
0
function getPostID($i)
{
    $photoFileOP = new sysFilesOperations();
    $id = $i;
    //GET THE OBJECT ID
    $photoFileOP->setRquery("SELECT * FROM amistiPic WHERE picID=?", array($id));
    $idRes = $photoFileOP->getRquery();
    //check ID
    if (count($idRes) > 0) {
        $id = $idRes[0]['postID'];
    }
    return $id;
}