예제 #1
0
//$CORE->ChmodWritable($file_path . $thumb_folder);
//handle the upload
if (move_uploaded_file($tempFile, $file_src_new)) {
    //try deleting the temp file
    @unlink($tempFile);
} else {
    $ERRORS->Add("The website failed to upload your screenshot. If this problem presists please contact the administration.");
}
//resample the image
$objImage = new ImageManipulation($file_src_new);
if ($objImage->imageok) {
    //resample the image
    $objImage->setJpegQuality(100);
    $objImage->save($file_src_new);
    //make a thumb
    $objImage->resizeProper($thumb_width, $thumb_height);
    $objImage->save($file_src_new_thumb);
    //get the time
    $time = $CORE->getTime();
    $type = TYPE_SCREENSHOT;
    $status = SCREENSHOT_STATUS_PENDING;
    //insert into the database
    $insert = $DB->prepare("INSERT INTO `images` (`name`, `descr`, `added`, `account`, `image`, `type`, `status`) VALUES (:name, :descr, :added, :account, :image, :type, :status);");
    $insert->bindParam(':name', $title, PDO::PARAM_STR);
    $insert->bindParam(':descr', $descr, PDO::PARAM_STR);
    $insert->bindParam(':added', $time, PDO::PARAM_STR);
    $insert->bindParam(':account', $CURUSER->get('id'), PDO::PARAM_INT);
    $insert->bindParam(':image', $imageName, PDO::PARAM_STR);
    $insert->bindParam(':type', $type, PDO::PARAM_INT);
    $insert->bindParam(':status', $status, PDO::PARAM_INT);
    $insert->execute();