Example #1
0
 function save()
 {
     //---Crear la galería con los nombres de todos los archivos
     $total = count($this->files);
     $cont = 0;
     //---Situar los thumbnails
     for ($i = 0; $i < $total; $i++) {
         $lame = $this->path . '/' . $this->files[$i];
         $saver = $this->path . '/thumb/' . $this->files[$i];
         //echo $saver."<br>";
         //echo $lame."<br>";
         $thumb = new thumbnail($lame);
         $thumb->size_height(250);
         $thumb->jpeg_quality(80);
         $thumb->save($saver);
     }
 }
 if ($size == '') {
     print 'Error size is no INTEGER';
     exit;
 }
 if ($size > $REX['ADDON']['max_size'][$mypage]) {
     print 'Error size to big: max ' . $REX['ADDON']['max_size'][$mypage] . ' px';
     exit;
 }
 // start thumb class
 $thumb = new thumbnail($imagepath);
 // check method
 if ($mode == 'w') {
     $thumb->size_width($size);
 }
 if ($mode == 'h') {
     $thumb->size_height($size);
 }
 if ($mode == 'c') {
     $thumb->size_crop($size, $hmode);
 } elseif ($hmode != '') {
     $thumb->size_height($hmode);
 }
 if ($mode == 'a') {
     $thumb->size_auto($size);
 }
 foreach ($rex_filter as $filter) {
     $thumb->addFilter($filter);
 }
 // jpeg quality
 $thumb->jpeg_quality($REX['ADDON']['jpeg_quality'][$mypage]);
 // save cache
    $fileTypes = array('jpg', 'jpeg', 'gif', 'png');
    // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);
    $image_ext = $fileParts['extension'];
    // Getting the image extention
    $image_name = basename($_FILES['Filedata']['name']);
    // Getting the image name
    // Generating a unique image path
    $image_path = md5(rand() * time()) . md5($image_name) . "." . $image_ext;
    // Generating a unique thumb image path
    $thumb_image_path = "thumb_" . $image_path;
    // Complete image path
    $targetFile = rtrim($targetPath, '/') . '/' . $image_path;
    // Complete thumb image path
    $thumbTargetFile = rtrim($targetPath, '/') . '/' . $thumb_image_path;
    $complete_image_path = $targetFolder . $image_path;
    $complete_thumb_path = $targetFolder . $thumb_image_path;
    if (in_array($image_ext, $fileTypes)) {
        copy($tempFile, $targetFile);
        //move_uploaded_file($tempFile,$targetFile);
        $thumb = new thumbnail($targetFile);
        $thumb->size_width(400);
        $thumb->size_height(300);
        $thumb->jpeg_quality(100);
        $thumb->save($thumbTargetFile);
        $query_obj->add_image($complete_thumb_path, $complete_image_path, "", 1, $dateTime, 1, $dateTime);
        echo '1';
    } else {
        echo 'Invalid file type.';
    }
}
Example #4
0
    echo "<SCRIPT language=\"javascript\">";
    echo "alert('Erreur lors de la connexion א la base de donnיes. Vous serez ramenי א la page d'acceuil.');";
    echo "top.location.href=\"/interPool/index.php\";";
    echo "</SCRIPT>";
    exit;
}
$id_saison = $sess->getSessVar('id_saison', '0');
$journalDir = "/export/home/www/interPool/images/journal/{$poolName}";
$thumbnailDir = $journalDir . "/thumbnails";
// tout d'un coup que le bouton send a יtי appuyי sans uploader de fichier...
if ($_FILES['file2upload']['tmp_name'] == "") {
    echo "<SCRIPT language=\"javascript\">";
    echo "window.location.href=\"/interPool/src/admin.php\";";
    echo "</SCRIPT>";
    exit;
}
// dיplacer le fichier uploadי dans le bon rיpertoire
$uploadfile = $journalDir . "/" . basename($_FILES['file2upload']['name']);
if (move_uploaded_file($_FILES['file2upload']['tmp_name'], $uploadfile)) {
    // crיation du thumbnail
    $thumbFile = $thumbnailDir . "/" . basename($_FILES['file2upload']['name']);
    $thumb = new thumbnail($uploadfile);
    $thumb->size_width(150);
    $thumb->size_height(200);
    $thumb->save($thumbFile);
    $query = "update accounts_detail set journal_vu='N'\n\t               where id_pool = {$id_pool}\n\t               and saison_id = {$id_saison}";
    mysql_query($query, $pool->handle);
}
echo "<SCRIPT language=\"javascript\">";
echo "window.location.href=\"/interPool/src/admin.php\";";
echo "</SCRIPT>";
Example #5
0
if ($size == '') {
    print "Error size is no INTEGER";
    exit;
}
if ($size > $max_size) {
    print "Error size to big: max {$max_size} px";
    exit;
}
// start thumb class
$thumb = new thumbnail($imagepath);
// check method
if ($mode == "w") {
    $thumb->size_width($size);
}
if ($mode == "h") {
    $thumb->size_height($size);
}
if ($mode == "a") {
    $thumb->size_auto($size);
}
// jpeg quality
$thumb->jpeg_quality($jpeg_quality);
// save cache
$thumb->save($cachepath);
// show file
$thumb->show();
// class thumbail
class thumbnail
{
    var $img;
    function thumbnail($imgfile)