Esempio n. 1
0
<?php

include_once getcwd() . "/classes/BLCarPicture.php";
include_once getcwd() . "/classes/BLCarFile.php";
include_once getcwd() . "/classes/BLBlobs.php";
$blCarPicture = new BLCarPicture();
$blCarFile = new BLCarFile();
$blBlobs = new BLBlobs();
$id = $_GET["site"];
$blob = $blBlobs->getBlobs($id);
header('"Content-length: ' . $blob->getFileSize() . '"');
header("Content-type: image/jpg");
header("Content-Disposition: attachment; filename=image.jpg");
echo $blob->getBlobData();
Esempio n. 2
0
<?php

include_once getcwd() . "/classes/BLCarFile.php";
include_once getcwd() . "/classes/BLBlobs.php";
$blCarFile = new BLCarFile();
$blBlobs = new BLBlobs();
if (isset($_POST['filenr'])) {
    $nr = $_POST["filenr"];
    $i = 0;
    for ($i = 1; $i < $nr; $i++) {
        //file uploaden + naar tabel wegschrijven
        if (trim($_POST["filetext" . $i]) != "") {
            if (!empty($_FILES['file' . $i])) {
                $file = $_POST["carid"] . "_" . strtolower(str_replace(" ", "_", $_FILES['file' . $i]['name']));
                $target_path = getcwd() . "/files/";
                //upload
                $target_path = $target_path . $file;
                chmod($target_path, 0777);
                if (move_uploaded_file($_FILES['file' . $i]['tmp_name'], $target_path)) {
                    $errorfiles .= '<span style="color:green">The file ' . $file . ' has been uploaded.<br />';
                    //Insert blob in table
                    $blobId = $blBlobs->uploadBlobs($target_path . $file);
                    $carfile = new CarFile(0, str_replace("." . findexts($file), "", $file), findexts($file), $_POST["filetext" . $i], $_POST["carid"], $blobId);
                    $blCarFile->insertCarFile($carfile);
                } else {
                    $errorfiles .= "There was an error uploading the file, please try again! (" . $file . ")<br />";
                }
            }
        } else {
            $errorfiles .= "Text is a required field! (" . $_FILES['file' . $i]['name'] . ")<br />";
        }
Esempio n. 3
0
<?php

include_once getcwd() . "/classes/BLCarFile.php";
include_once getcwd() . "/classes/BLBlobs.php";
$blCarFile = new BLCarFile();
$blBlobs = new BLBlobs();
if (isset($_GET["id"])) {
    $id = $_GET["id"];
    $carfile = $blCarFile->getCarFile($id);
    $blCarFile->deleteCarFile($id);
    $blBlobs->deleteBlobs($carfile->getBlobId());
    unlink(getcwd() . "/files/" . $carfile->getName() . "." . $carfile->getType());
}
Esempio n. 4
0
<?php

include_once getcwd() . "/classes/BLCarPicture.php";
include_once getcwd() . "/classes/BLCarFile.php";
include_once getcwd() . "/classes/BLBlobs.php";
$blCarPicture = new BLCarPicture();
$blCarFile = new BLCarFile();
$blBlobs = new BLBlobs();
$files = $blCarFile->getCarFiles();
$pictures = $blCarPicture->getCarPictures();
echo '<h1>Files</h1>';
foreach ($files as $file) {
    if ($file->getBlobId() == null) {
        //Import file
        try {
            echo "Start: " . $file->getName() . "<br />";
            $path = getcwd() . "/files/" . $file->getName() . "." . $file->getType();
            $blobId = $blBlobs->uploadBlobs($path);
            $file->setBlobId($blobId);
            $blCarFile->updateCarFile($file);
            echo "End: " . $file->getName() . " uploaded!<br /><hr />";
        } catch (Exception $ex) {
            echo $ex;
        }
    }
}
echo '<h1>Pictures</h1>';
foreach ($pictures as $picture) {
    if ($picture->getBlobId() == null) {
        //Import picture
        try {
Esempio n. 5
0
<?php

include_once getcwd() . "/classes/BLCar.php";
include_once getcwd() . "/classes/BLCarPicture.php";
include_once getcwd() . "/classes/BLPictureOrder.php";
include_once getcwd() . "/classes/BLBlobs.php";
$blCar = new BLCar();
$blCarPicture = new BLCarPicture();
$blPictureOrder = new BLPictureOrder();
$blBlobs = new BLBlobs();
if (isset($_GET["id"])) {
    $id = $_GET["id"];
    $carpic = $blCarPicture->getCarPicture($id);
    $car = $blCar->getCar($carpic->getCarId());
    if ($car->getDefaultPictureId() == $id) {
        echo "A default picture can not be deleted!";
    } else {
        $blCarPicture->deleteCarPicture($id);
        $blBlobs->deleteBlobs($carpic->getBlobId());
        $blPictureOrder->deleteCarPictureFromList($id);
        unlink(getcwd() . "/pictures/" . $carpic->getName() . "." . $carpic->getType());
    }
}
Esempio n. 6
0
<?php

include_once getcwd() . "/classes/BLCar.php";
include_once getcwd() . "/classes/BLCarPicture.php";
include_once getcwd() . "/classes/BLPictureOrder.php";
include_once getcwd() . "/classes/BLBlobs.php";
$blCar = new BLCar();
$blCarPicture = new BLCarPicture();
$blPictureOrder = new BLPictureOrder();
$blBlobs = new BLBlobs();
include_once getcwd() . "/include/imagehandler.php";
$upload_name = "Filedata";
//image uploaden + naar tabel wegschrijven
if (!empty($_FILES[$upload_name])) {
    if (findexts($_FILES[$upload_name]['name']) == "jpg" || findexts($_FILES[$upload_name]['name']) == "jpeg" || findexts($_FILES[$upload_name]['imagename']) == "gif" || findexts($_FILES[$upload_name]['name']) == "png") {
        $file = $_POST["CARID"] . "_" . strtolower(str_replace(" ", "_", $_FILES[$upload_name]['name']));
        $path = getcwd() . "/pictures/";
        //large
        $errorim = upload($_FILES[$upload_name]['tmp_name'], $path, $file, 1600, 1600);
        chmod($path . $file, 0777);
        //class
        if ($errorim[0] == true) {
            //Insert blob in table
            $blobId = $blBlobs->uploadBlobs($path . $file);
            $carpicture = new CarPicture(0, str_replace("." . findexts($file), "", $file), findexts($file), $_POST["CARID"], $blobId);
            $carpicture->setId($blCarPicture->insertCarPicture($carpicture));
            $car = $blCar->getCar($_POST["CARID"]);
            //default
            if ($car->getDefaultPictureId() == null) {
                $car->setDefaultPictureId($carpicture->getId());
                $blCar->updateCar($car);
Esempio n. 7
0
<?php

include_once getcwd() . "/classes/BLCarPicture.php";
include_once getcwd() . "/classes/BLCarFile.php";
include_once getcwd() . "/classes/BLBlobs.php";
$blCarPicture = new BLCarPicture();
$blCarFile = new BLCarFile();
$blBlobs = new BLBlobs();
$files = $blCarFile->getCarFiles();
$pictures = $blCarPicture->getCarPictures();
echo '<h1>Files</h1>';
foreach ($files as $file) {
    if ($file->getBlobId() != null) {
        //Import file
        try {
            $path = getcwd() . "/files/" . $file->getName() . "." . $file->getType();
            if (!file_exists($path)) {
                echo "Start: " . $file->getName() . "<br />";
                //Synchronize
                $blBlobs->downloadBlobs($file->getBlobId(), $path);
                echo "End: " . $file->getName() . " synchronized!<br /><hr />";
            }
        } catch (Exception $ex) {
            echo $ex;
        }
    }
}
echo '<h1>Pictures</h1>';
foreach ($pictures as $picture) {
    if ($picture->getBlobId() != null) {
        //Import picture