Exemple #1
0
function perform_upload($spojeni, $filename, $fextension, $temp_file, $filesize, $filetype, $fileerror, $nazev, $id)
{
    $goodSize = $filesize < 1950000;
    $allowedExts = array("jpg", "jpeg", "gif", "png");
    $extensionMatch = in_array(strtolower($fextension), $allowedExts);
    if (!$extensionMatch) {
        echo "Soubor není typu obrázek<br>";
    }
    if ($goodSize && $extensionMatch) {
        if ($fileerror > 0) {
            echo "Return Code: " . $fileerror . "<br/>";
        } else {
            echo "<ul>";
            echo "<li>Upload: " . $filename . "</li><br/>";
            echo "<li>Type: " . $filetype . " </li><br/>";
            echo "<li>Size: " . $filesize / 1024 . " Kb</li><br/>";
            echo "</ul>";
            $location = CESTAOBRAZKY . "/" . $id . "-" . $filename;
            $locationsm = CESTAOBRAZKY . "/" . $id . "-sm" . $filename;
            if (!move_uploaded_file($temp_file, $location)) {
                echo "failed to move the upload file to {$location}<br>";
            } else {
                echo "Stored in: " . $location;
            }
            resizePhoto($location, $locationsm, RESIZEX, RESIZEY, ZACHOVATSTRANY, '75');
            $sql = "INSERT INTO foto (id_galerie,nazev,soubor,soubormale,datumvlozeni) VALUES ({$id},'{$filename}','{$location}','{$locationsm}',NOW())";
            $res = PrSql($spojeni, $sql);
        }
    } else {
        echo "Nesprávná přípona souboru: {$fextension}";
    }
}
Exemple #2
0
<?php

/************************************
Author: Abel Conde
Profession: Software Developer
Github: https://github.com/abelcondear
Twitter: https://twitter.com/abelcondear
LinkedIN: https://ar.linkedin.com/in/abelcondear
************************************/
require_once '../class/simpleimage/CSimpleImage.class.php';
require_once '../utils.php';
resizePhoto('../images/gallery/' . $_GET['filename'], $_GET['width'], $_GET['height']);