Esempio n. 1
0
     $db->query($query);
 }
 //Anhänge aktualisieren
 $attachments = '';
 $data = $db->fetch("\n\t\t\t\tSELECT id, file FROM\n\t\t\t\t" . PRE . "_forum_attachments\n\t\t\t");
 if (count($data)) {
     require BASEDIR . 'lib/class.mediamanager.php';
     require BASEDIR . 'lib/class.image.php';
     $mm = new mediamanager();
     $img = new image();
     foreach ($data as $res) {
         $ext = strtolower($mm->getext($res['file']));
         if (in_array($ext, array('gif', 'jpg', 'jpe', 'jpeg', 'png'))) {
             $fileid = substr($res['file'], 0, -1 * (strlen($ext) - 1));
             $thumbnailPath = $fileid . '_thumb.' . $ext;
             list($picture, $picturetype) = $img->getimage($res['file']);
             //////// THUMBNAIL
             $thumbnail = $img->resize($picture, 120, 90, true);
             $img->saveimage($thumbnail, $picturetype, $thumbnailPath);
             //Cleanup
             imagedestroy($picture);
             imagedestroy($thumbnail);
             unset($picture, $thumbnail);
             //Update SQL
             $db->query("UPDATE " . PRE . "_forum_attachments SET thumbnail='" . addslashes($thumbnailPath) . "' WHERE id='" . $res['id'] . "' LIMIT 1");
         }
     }
 }
 //Thread- und Beitragszahlen berichtigen
 @set_time_limit(600);
 $data = $db->fetch("\n\t\t\t\tSELECT forumid\n\t\t\t\tFROM " . PRE . "_forums\n\t\t\t");
Esempio n. 2
0
 $tempname = 'avatar_' . md5(microtime()) . '.tmp';
 $mm->uploadfile($_FILES['avatar'], 'temp', $tempname);
 $info = getimagesize(BASEDIR . getpath('uploads') . 'temp/' . $tempname);
 //Kein Bild => löschen und Ende
 if ($info[0] == 0 || $info[1] == 0) {
     $mm->deletefile('temp/' . $tempname);
     message($apx->lang->get('MSG_MAXDIM'), 'javascript:history.back()');
     require 'lib/_end.php';
 }
 //Bild zu groß => verkleinern
 if ($info[0] > $set['user']['avatar_maxdim'] || $info[1] > $set['user']['avatar_maxdim']) {
     if ($ext == 'GIF') {
         $ext = 'jpg';
     }
     $newfile = 'avatar_' . $user->info['userid'] . '_' . time() . '.' . strtolower($ext);
     list($picture, $picturetype) = $img->getimage('temp/' . $tempname);
     $scaled = $img->resize($picture, $set['user']['avatar_maxdim'], $set['user']['avatar_maxdim'], 1, 0);
     if ($scaled != $picture) {
         imagedestroy($picture);
     }
     $img->saveimage($scaled, $picturetype, 'user/' . $newfile);
     imagedestroy($scaled);
 } else {
     $mm->copyfile('temp/' . $tempname, 'user/' . $newfile);
 }
 $mm->deletefile('temp/' . $tempname);
 $db->query("UPDATE " . PRE . "_user SET avatar='" . addslashes($newfile) . "',avatar_title='" . addslashes($_POST['avatar_title']) . "' WHERE userid='" . $user->info['userid'] . "' LIMIT 1");
 if ($user->info['avatar']) {
     $mm->deletefile('user/' . $user->info['avatar']);
 }
 message($apx->lang->get('MSG_OK'), mklink('user.php?action=avatar', 'user,avatar.html'));
Esempio n. 3
0
 function padd()
 {
     global $set, $db, $apx;
     $_REQUEST['id'] = (int) $_REQUEST['id'];
     if (!$_REQUEST['id']) {
         die('missing ID!');
     }
     if (!$this->access_pics($_REQUEST['id'], 'videos.padd')) {
         die('you have no right to access this video!');
     }
     if ($_POST['send'] == 1) {
         require_once BASEDIR . 'lib/class.image.php';
         $img = new image();
         $tblinfo = $db->first("SHOW TABLE STATUS LIKE '" . PRE . "_videos_screens'");
         $nextid = $tblinfo['Auto_increment'];
         //Bilder prüfen
         $error = array();
         for ($i = 1; $i <= $set['videos']['addpics']; $i++) {
             if (!$_FILES['upload' . $i]['tmp_name']) {
                 continue;
             }
             $imginfo = getimagesize($_FILES['upload' . $i]['tmp_name']);
             if (!in_array($imginfo[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
                 $error[] = $apx->lang->get('MSG_NOIMAGE', array('NAME' => $_FILES['upload' . $i]['name']));
             }
             if ($error) {
                 info(implode('<br />', $error));
                 return;
             }
         }
         //Bilder abarbeiten
         for ($i = 1; $i <= $set['videos']['addpics']; $i++) {
             if (!$_FILES['upload' . $i]['tmp_name']) {
                 continue;
             }
             $ext = strtolower($this->mm->getext($_FILES['upload' . $i]['name']));
             if ($ext == 'gif') {
                 $ext = 'jpg';
             }
             $newname = 'pic' . '-' . $_POST['id'] . '-' . $nextid . '.' . $ext;
             $newfile = 'videos/screens/' . $newname;
             $thumbname = 'pic' . '-' . $_POST['id'] . '-' . $nextid . '-thumb.' . $ext;
             $thumbfile = 'videos/screens/' . $thumbname;
             //Erfolgreichen Upload prüfen
             if (!$this->mm->uploadfile($_FILES['upload' . $i], 'videos/screens', $newname)) {
                 continue;
             }
             //Bild einlesen
             list($picture, $picturetype) = $img->getimage($newfile);
             //////// THUMBNAIL
             $thumbnail = $img->resize($picture, $set['videos']['thumbwidth'], $set['videos']['thumbheight'], $set['videos']['quality_resize'], $set['videos']['thumb_fit']);
             $img->saveimage($thumbnail, $picturetype, $thumbfile);
             //////// BILD
             //Bild skalieren
             if ($picture !== false && !$_POST['noresize' . $i] && $set['videos']['picwidth'] && $set['videos']['picheight']) {
                 $scaled = $img->resize($picture, $set['videos']['picwidth'], $set['videos']['picheight'], $set['videos']['quality_resize'], 0);
                 if ($scaled != $picture) {
                     imagedestroy($picture);
                 }
                 $picture = $scaled;
             }
             //Wasserzeichen einfügen
             if ($picture !== false && $set['videos']['watermark'] && $_POST['watermark' . $i]) {
                 $watermarked = $img->watermark($picture, $set['videos']['watermark'], $set['videos']['watermark_position'], $set['videos']['watermark_transp']);
                 if ($watermarked != $picture) {
                     imagedestroy($picture);
                 }
                 $picture = $watermarked;
             }
             //Bild erstellen
             $img->saveimage($picture, $picturetype, $newfile);
             //Cleanup
             imagedestroy($picture);
             imagedestroy($thumbnail);
             unset($picture, $thumbnail);
             //In DB eintragen
             $db->query("INSERT INTO " . PRE . "_videos_screens (videoid, thumbnail, picture) VALUES ('" . $_REQUEST['id'] . "', '" . addslashes($thumbfile) . "', '" . addslashes($newfile) . "')");
             logit('VIDEOS_PADD', 'ID #' . $nextid);
             ++$nextid;
         }
         printJSRedirect('action.php?action=videos.pshow&id=' . $_REQUEST['id']);
         return;
     } else {
         for ($i = 1; $i <= $set['videos']['addpics']; $i++) {
             $_POST['watermark' . $i] = 1;
             $_POST['allowcoms' . $i] = 1;
             $_POST['allowrating' . $i] = 1;
         }
     }
     //Felder ausgeben
     for ($i = 1; $i <= $set['videos']['addpics']; $i++) {
         $upload[$i]['CAPTION'] = compatible_hsc($_POST['caption' . $i]);
         $upload[$i]['WATERMARK'] = 1;
         $upload[$i]['NORESIZE'] = 0;
         $upload[$i]['ALLOWCOMS'] = 1;
         $upload[$i]['ALLOWRATING'] = 1;
     }
     $apx->tmpl->assign('ID', $_REQUEST['id']);
     $apx->tmpl->assign('UPLOAD', $upload);
     $apx->tmpl->assign('SET_WATERMARK', iif($set['videos']['watermark'], 1, 0));
     $apx->tmpl->assign('SET_NORESIZE', iif($set['videos']['picwidth'] && $set['videos']['picheight'], 1, 0));
     $apx->tmpl->parse('padd');
 }
Esempio n. 4
0
                $message .= '<br />';
            }
            $message .= $apx->lang->get('MSG_NOUPLOAD', array('FILE' => $file['name'])) . ' ';
            $message .= $apx->lang->get('MSG_TOOBIG', array('MAXSIZE' => $typeinfo[$ext][0]));
            continue;
        }
        $fileid = str_replace(' ', '_', $mm->getname($file['name'])) . '_' . time();
        $newname = $fileid . '.' . $ext;
        $thumbnailPath = '';
        $mm->uploadfile($_FILES['file' . $i], 'forum', $newname);
        //Thumbnail erzeugen
        if (in_array($ext, array('gif', 'jpg', 'jpe', 'jpeg', 'png'))) {
            require_once BASEDIR . 'lib/class.image.php';
            $img = new image();
            $thumbnailPath = 'forum/' . $fileid . '_thumb.' . $ext;
            list($picture, $picturetype) = $img->getimage('forum/' . $newname);
            //////// THUMBNAIL
            $thumbnail = $img->resize($picture, 120, 90, true);
            $img->saveimage($thumbnail, $picturetype, $thumbnailPath);
            //Cleanup
            imagedestroy($picture);
            imagedestroy($thumbnail);
            unset($picture, $thumbnail);
        }
        $db->query("INSERT INTO " . PRE . "_forum_attachments (hash,postid,file,thumbnail,name,size,mime,time) VALUES ('" . addslashes($_REQUEST['hash']) . "','" . $_REQUEST['postid'] . "','" . addslashes('forum/' . $newname) . "','" . addslashes($thumbnailPath) . "','" . addslashes($file['name']) . "','" . intval($file['size']) . "','" . addslashes($file['type']) . "','" . time() . "')");
        if ($message) {
            $message .= '<br />';
        }
        $message .= $apx->lang->get('MSG_OK', array('FILE' => $file['name']));
    }
}
Esempio n. 5
0
 function inline_upload()
 {
     global $set, $db, $apx;
     $file = $_FILES['image'];
     //Prüfen ob eine Datei hochgeladen wurde, falls ja verschieben
     if (!$file['tmp_name']) {
         return;
     }
     if (!is_uploaded_file($file['tmp_name'])) {
         return;
     }
     if (!checkToken()) {
         printInvalidToken();
         exit;
     }
     $ext = strtolower($this->mm->getext($file['name']));
     if ($ext == 'gif') {
         $ext = 'jpg';
     }
     $tempfile = md5(microtime()) . '.' . $ext;
     $this->mm->uploadfile($file, 'inline', $tempfile);
     //Nächste ID auslesen
     $tblinfo = $db->first("SHOW TABLE STATUS LIKE '" . PRE . "_inlinescreens'");
     $now = time();
     //Einheitliche Upload-Zeit, auch wenns nicht stimmt
     $newname = 'pic' . '-' . $tblinfo['Auto_increment'] . '.' . $ext;
     $newfile = 'inline/' . $newname;
     $popname = 'pic' . '-' . $tblinfo['Auto_increment'] . '-popup.' . $ext;
     $popfile = 'inline/' . $popname;
     //Bild einlesen
     require_once BASEDIR . 'lib/class.image.php';
     $img = new image();
     ////// NORMALES BILD
     list($picture, $picturetype) = $img->getimage('inline/' . $tempfile);
     //Skalieren
     if ($picture !== false && ($_POST['size_x'] || $_POST['size_y'])) {
         $scaled = $img->resize($picture, $_POST['size_x'], $_POST['size_y'], $set['mediamanager']['quality_resize'], 0);
         if ($scaled != $picture) {
             imagedestroy($picture);
         }
         $picture = $scaled;
     }
     //Wasserzeichen einfügen
     if ($picture !== false && $set['mediamanager']['watermark'] && $_POST['watermark']) {
         $watermarked = $img->watermark($picture, $set['mediamanager']['watermark'], $set['mediamanager']['watermark_position'], $set['mediamanager']['watermark_transp']);
         if ($watermarked != $picture) {
             imagedestroy($picture);
         }
         $picture = $watermarked;
     }
     //Bild erstellen
     $img->saveimage($picture, $picturetype, $newfile);
     imagedestroy($picture);
     ////// POPUP-BILD
     if ($_POST['popup']) {
         list($picture, $picturetype) = $img->getimage('inline/' . $tempfile);
         //Skalieren
         if ($picture !== false && ($_POST['popup_size_x'] || $_POST['popup_size_y'])) {
             $scaled = $img->resize($picture, $_POST['popup_size_x'], $_POST['popup_size_y'], $set['mediamanager']['quality_resize'], 0);
             if ($scaled != $picture) {
                 imagedestroy($picture);
             }
             $picture = $scaled;
         }
         //Wasserzeichen einfügen
         if ($picture !== false && $set['mediamanager']['watermark'] && $_POST['popup_watermark']) {
             $watermarked = $img->watermark($picture, $set['mediamanager']['watermark'], $set['mediamanager']['watermark_position'], $set['mediamanager']['watermark_transp']);
             if ($watermarked != $picture) {
                 imagedestroy($picture);
             }
             $picture = $watermarked;
         }
         //Bild erstellen
         $img->saveimage($picture, $picturetype, $popfile);
         imagedestroy($picture);
     }
     //Cachefile löschen
     $this->mm->deletefile('inline/' . $tempfile);
     $_POST['addtime'] = time();
     $_POST['picture'] = $newfile;
     if ($_POST['popup']) {
         $_POST['popup'] = $popfile;
     } else {
         $_POST['popup'] = '';
     }
     $db->dinsert(PRE . '_inlinescreens', 'module,mid,hash,picture,popup,align,text,addtime');
     logit('MEDIAMANAGER_INLINE', 'ID #' . $db->insert_id());
     printJSRedirect('action.php?action=mediamanager.inline&module=' . $_REQUEST['module'] . '&mid=' . $_REQUEST['mid'] . '&hash=' . $_REQUEST['hash'] . '&fields=' . $_REQUEST['fields']);
     exit;
 }
Esempio n. 6
0
 function pictures()
 {
     global $set, $db, $apx;
     //Notwendig weil 1.7.0 beim Kopieren ein Bild mit ID 0 erzeugt hatte :/
     if (isset($_REQUEST['delpic'])) {
         $_REQUEST['delpic'] = (int) $_REQUEST['delpic'];
     } else {
         $_REQUEST['delpic'] = null;
     }
     //Bilder auslesen
     list($pictures, $nextid) = $db->first("SELECT pictures,pictures_nextid FROM " . PRE . "_articles WHERE id='" . $_REQUEST['id'] . "'");
     $pictures = unserialize($pictures);
     if (!is_array($pictures)) {
         $pictures = array();
     }
     //Bild löschen
     if (isset($_REQUEST['delpic']) && isset($pictures[$_REQUEST['delpic']])) {
         if ($_POST['delpic']) {
             if (!checkToken()) {
                 printInvalidToken();
             } else {
                 $picinfo = $pictures[$_REQUEST['delpic']];
                 require BASEDIR . 'lib/class.mediamanager.php';
                 $mm = new mediamanager();
                 if ($picinfo['thumbnail'] && file_exists(BASEDIR . getpath('uploads') . $picinfo['thumbnail'])) {
                     $mm->deletefile($picinfo['thumbnail']);
                 }
                 if ($picinfo['picture'] && file_exists(BASEDIR . getpath('uploads') . $picinfo['picture'])) {
                     $mm->deletefile($picinfo['picture']);
                 }
                 unset($pictures[$_REQUEST['delpic']]);
                 $db->query("UPDATE " . PRE . "_articles SET pictures='" . addslashes(serialize($pictures)) . "' WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
                 printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=pics');
             }
         } else {
             tmessageOverlay('picdel', array('ID' => $_REQUEST['id'], 'DELPIC' => $_REQUEST['delpic']));
         }
     } elseif ($_POST['send']) {
         require BASEDIR . 'lib/class.mediamanager.php';
         $mm = new mediamanager();
         require_once BASEDIR . 'lib/class.image.php';
         $img = new image();
         //Bilder abarbeiten
         for ($i = 1; $i <= 5; $i++) {
             if (!$_FILES['upload' . $i]['tmp_name']) {
                 continue;
             }
             $ext = strtolower($mm->getext($_FILES['upload' . $i]['name']));
             if ($ext == 'gif') {
                 $ext = 'jpg';
             }
             $newname = 'pic' . '-' . $_POST['id'] . '-' . $nextid . '.' . $ext;
             $newfile = 'articles/gallery/' . $newname;
             $thumbname = 'pic' . '-' . $_POST['id'] . '-' . $nextid . '-thumb.' . $ext;
             $thumbfile = 'articles/gallery/' . $thumbname;
             //Erfolgreichen Upload prüfen
             if (!$mm->uploadfile($_FILES['upload' . $i], 'articles/gallery', $newname)) {
                 continue;
             }
             //Bild einlesen
             list($picture, $picturetype) = $img->getimage($newfile);
             //////// THUMBNAIL
             $thumbnail = $img->resize($picture, $set['articles']['thumbwidth'], $set['articles']['thumbheight'], $set['articles']['artpic_quality']);
             $img->saveimage($thumbnail, $picturetype, $thumbfile);
             //////// BILD
             //Bild skalieren
             if ($picture !== false && !$_POST['noresize' . $i] && $set['articles']['picwidth'] && $set['articles']['picheight']) {
                 $scaled = $img->resize($picture, $set['articles']['picwidth'], $set['articles']['picheight'], $set['articles']['artpic_quality'], 0);
                 if ($scaled != $picture) {
                     imagedestroy($picture);
                 }
                 $picture = $scaled;
             }
             //Wasserzeichen einfügen
             if ($picture !== false && $set['articles']['watermark'] && $_POST['watermark' . $i]) {
                 $watermarked = $img->watermark($picture, $set['articles']['watermark'], $set['articles']['watermark_position'], $set['articles']['watermark_transp']);
                 if ($watermarked != $picture) {
                     imagedestroy($picture);
                 }
                 $picture = $watermarked;
             }
             //Bild erstellen
             $img->saveimage($picture, $picturetype, $newfile);
             //Cleanup
             imagedestroy($picture);
             imagedestroy($thumbnail);
             unset($picture, $thumbnail);
             $pictures[$nextid] = array('picture' => $newfile, 'thumbnail' => $thumbfile);
             ++$nextid;
         }
         //Bilder eintragen
         $db->query("UPDATE " . PRE . "_articles SET pictures='" . addslashes(serialize($pictures)) . "',pictures_nextid='" . intval($nextid) . "' WHERE id='" . $_REQUEST['id'] . "' LIMIT 1");
         //Artikel beenden
         if ($_POST['submit_finish']) {
             $this->finish_article();
             return;
         } else {
             printJSRedirect('action.php?action=' . $_REQUEST['action'] . '&id=' . $_REQUEST['id'] . '&pubnow=' . $_REQUEST['pubnow'] . '&pageid=pics');
         }
     } else {
         echo '<h2>' . $apx->lang->get(iif($this->type == 'normal', 'ARTICLE', strtoupper($this->type))) . ': ' . $this->title . '</h2>';
         //Bilderserie auflisten
         foreach ($pictures as $id => $res) {
             ++$i;
             $picdata[$i]['ID'] = $id;
             $picdata[$i]['IMAGE'] = HTTPDIR . getpath('uploads') . $res['thumbnail'];
             $picdata[$i]['LINK'] = HTTPDIR . getpath('uploads') . $res['picture'];
             $picdata[$i]['OPTIONS'] .= optionHTMLOverlay('del.gif', $_REQUEST['action'], 'id=' . $_REQUEST['id'] . '&pageid=pics&delpic=' . $id . '&pubnow=' . $_REQUEST['pubnow'], $apx->lang->get('CORE_DEL'));
         }
         $apx->tmpl->assign('SET_WATERMARK', iif($set['articles']['watermark'], 1, 0));
         $apx->tmpl->assign('SET_NORESIZE', iif($set['articles']['picwidth'] && $set['articles']['picheight'], 1, 0));
         $apx->tmpl->assign('PIC', $picdata);
         $apx->tmpl->assign('PUBNOW', (int) $_REQUEST['pubnow']);
         $apx->tmpl->assign('ID', $_REQUEST['id']);
         $apx->tmpl->assign('ACTION', iif($_REQUEST['action'] == 'articles.add', 'add', 'edit'));
         $apx->tmpl->parse('pictures');
     }
 }
 function makeScreenshots($flvFile, $duration, $id)
 {
     $files = array();
     $screenid = 1;
     require_once BASEDIR . 'lib/class.image.php';
     $img = new image();
     //Screenshots machen
     for ($i = 1; $i <= 10; $i += 2) {
         unset($output);
         $newname = 'pic-' . $id . '-' . $screenid . '.jpg';
         $newfile = 'videos/screens/' . $newname;
         $thumbname = 'pic-' . $id . '-' . $screenid . '-thumb.jpg';
         $thumbfile = 'videos/screens/' . $thumbname;
         //Screenshot erzeugen
         $screenfrom = floor($duration / 11 * $i);
         $cmd = $this->ffmpeg . ' -itsoffset -' . $screenfrom . ' -i ' . $flvFile . ' -vframes 1 -f mjpeg -sameq ' . BASEDIR . getpath('uploads') . $newfile . ' 2>&1';
         exec($cmd, $output, $returnval);
         echo $cmd . "\n" . implode("\n", $output) . "\nreturns " . $returnval . "\n";
         echo "\n--------------------------------------------\n\n";
         $this->forceLogOut();
         //Bild einlesen
         list($picture, $picturetype) = $img->getimage($newfile);
         //////// THUMBNAIL
         $thumbnail = $img->resize($picture, $this->thumbwidth, $this->thumbheight, $this->quality_resize, false);
         $img->saveimage($thumbnail, $picturetype, $thumbfile);
         //////// BILD
         //Bild skalieren
         if ($picture !== false && $this->picwidth && $this->picheight) {
             $scaled = $img->resize($picture, $this->picwidth, $this->picheight, $this->quality_resize, 0);
             if ($scaled != $picture) {
                 imagedestroy($picture);
             }
             $picture = $scaled;
         }
         //Wasserzeichen einfügen
         if ($picture !== false && $this->watermark) {
             $watermarked = $img->watermark($picture, $this->watermark, $this->watermark_position, $this->watermark_transp);
             if ($watermarked != $picture) {
                 imagedestroy($picture);
             }
             $picture = $watermarked;
         }
         //Bild erstellen
         $img->saveimage($picture, $picturetype, $newfile);
         //Cleanup
         imagedestroy($picture);
         imagedestroy($thumbnail);
         unset($picture, $thumbnail);
         $files[] = array('thumbnail' => $thumbfile, 'picture' => $newfile);
         ++$screenid;
     }
     return $files;
 }
Esempio n. 8
0
 } else {
     require_once BASEDIR . 'lib/class.image.php';
     $img = new image();
     $tblinfo = $db->first("SHOW TABLE STATUS LIKE '" . PRE . "_user_pictures'");
     $now = time();
     //Einheitliche Upload-Zeit, auch wenns nicht stimmt
     $i = 0;
     foreach ($files as $file) {
         ++$i;
         $random = random_string(5);
         $newname = 'pic' . '-' . ($tblinfo['Auto_increment'] + $i - 1) . '-' . $random . '.' . $file['ext'];
         $newfile = 'user/gallery-' . $galid . '/' . $newname;
         $thumbname = 'pic' . '-' . ($tblinfo['Auto_increment'] + $i - 1) . '-thumb-' . $random . '.' . $file['ext'];
         $thumbfile = 'user/gallery-' . $galid . '/' . $thumbname;
         //Bild einlesen
         list($picture, $picturetype) = $img->getimage($file['source']);
         //////// THUMBNAIL
         $thumbnail = $img->resize($picture, $set['user']['gallery_thumbwidth'], $set['user']['gallery_thumbheight'], $set['user']['gallery_quality_resize'], $set['user']['gallery_thumb_fit']);
         $img->saveimage($thumbnail, $picturetype, $thumbfile);
         //////// BILD
         //Skalieren
         if ($picture !== false && !$file['noresize'] && $set['user']['gallery_picwidth'] && $set['user']['gallery_picheight']) {
             $scaled = $img->resize($picture, $set['user']['gallery_picwidth'], $set['user']['gallery_picheight'], $set['user']['gallery_quality_resize'], 0);
             if ($scaled != $picture) {
                 imagedestroy($picture);
             }
             $picture = $scaled;
         }
         //Bild erstellen
         $img->saveimage($picture, $picturetype, $newfile);
         //Cleanup
Esempio n. 9
0
 function process_files($files)
 {
     global $set, $db, $apx;
     $tblinfo = $db->first("SHOW TABLE STATUS LIKE '" . PRE . "_gallery_pics'");
     $now = time();
     //Einheitliche Upload-Zeit, auch wenns nicht stimmt
     require_once BASEDIR . 'lib/class.image.php';
     $img = new image();
     $mm = new mediamanager();
     foreach ($files as $file) {
         ++$i;
         $newname = 'pic' . '-' . ($tblinfo['Auto_increment'] + $i - 1) . '.' . $file['ext'];
         $newfile = 'gallery/' . $_REQUEST['id'] . '/' . $newname;
         $thumbname = 'pic' . '-' . ($tblinfo['Auto_increment'] + $i - 1) . '-thumb.' . $file['ext'];
         $thumbfile = 'gallery/' . $_REQUEST['id'] . '/' . $thumbname;
         //Bild einlesen
         list($picture, $picturetype) = $img->getimage($file['source']);
         //////// THUMBNAIL
         $thumbnail = $img->resize($picture, $set['gallery']['thumbwidth'], $set['gallery']['thumbheight'], $set['gallery']['quality_resize'], $set['gallery']['thumb_fit']);
         $img->saveimage($thumbnail, $picturetype, $thumbfile);
         //////// BILD
         //Skalieren
         if ($picture !== false && !$file['noresize'] && $set['gallery']['picwidth'] && $set['gallery']['picheight']) {
             $scaled = $img->resize($picture, $set['gallery']['picwidth'], $set['gallery']['picheight'], $set['gallery']['quality_resize'], 0);
             if ($scaled != $picture) {
                 imagedestroy($picture);
             }
             $picture = $scaled;
         }
         //Wasserzeichen einfügen
         if ($picture !== false && $set['gallery']['watermark'] && $file['watermark']) {
             $watermarked = $img->watermark($picture, $set['gallery']['watermark'], $set['gallery']['watermark_position'], $set['gallery']['watermark_transp']);
             if ($watermarked != $picture) {
                 imagedestroy($picture);
             }
             $picture = $watermarked;
         }
         //Bild erstellen
         $img->saveimage($picture, $picturetype, $newfile);
         //Cleanup
         imagedestroy($picture);
         imagedestroy($thumbnail);
         unset($picture, $thumbnail);
         if ($_POST['what'] != 'ftp' || $_POST['delpics']) {
             $mm->deletefile($file['source']);
         }
         $db->query("INSERT INTO " . PRE . "_gallery_pics VALUES (0,'" . $_REQUEST['id'] . "','" . $thumbfile . "','" . $newfile . "','" . addslashes($file['caption']) . "',0,'" . $now . "','" . (int) $file['allowcoms'] . "','" . (int) $file['allowrating'] . "','1','0')");
         logit('GALLERY_PADD', 'ID #' . $db->insert_id());
     }
     $this->files = $i;
 }