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);
     }
 }
Example #2
0
 if (strpos($image_name, "php") !== false) {
     die("Hacking attempt!");
 }
 if (is_uploaded_file($image) and !$stop) {
     if (intval($user_group[$member_id['user_group']]['max_foto']) > 0) {
         if ($image_size < 100000) {
             $allowed_extensions = array("jpg", "png", "jpe", "jpeg", "gif");
             if (in_array($type, $allowed_extensions) and $image_name) {
                 include_once ENGINE_DIR . '/classes/thumb.class.php';
                 $res = @move_uploaded_file($image, ROOT_DIR . "/uploads/fotos/" . $row['user_id'] . "." . $type);
                 if ($res) {
                     @chmod(ROOT_DIR . "/uploads/fotos/" . $row['user_id'] . "." . $type, 0666);
                     $thumb = new thumbnail(ROOT_DIR . "/uploads/fotos/" . $row['user_id'] . "." . $type);
                     if ($thumb->size_auto($user_group[$member_id['user_group']]['max_foto'])) {
                         $thumb->jpeg_quality($config['jpeg_quality']);
                         $thumb->save(ROOT_DIR . "/uploads/fotos/foto_" . $row['user_id'] . "." . $type);
                     } else {
                         if ($type == "gif") {
                             @rename(ROOT_DIR . "/uploads/fotos/" . $row['user_id'] . "." . $type, ROOT_DIR . "/uploads/fotos/foto_" . $row['user_id'] . "." . $type);
                         } else {
                             $thumb->jpeg_quality($config['jpeg_quality']);
                             $thumb->save(ROOT_DIR . "/uploads/fotos/foto_" . $row['user_id'] . "." . $type);
                         }
                     }
                     @chmod(ROOT_DIR . "/uploads/fotos/foto_" . $row['user_id'] . "." . $type, 0666);
                     $foto_name = "foto_" . $row['user_id'] . "." . $type;
                     $db->query("UPDATE " . USERPREFIX . "_users set foto='{$foto_name}' WHERE user_id = '{$id}'");
                 } else {
                     $stop .= $lang['news_err_14'];
                 }
             } else {
Example #3
0
 }
 if (stripos($image_name, "php") !== false) {
     die("Hacking attempt!");
 }
 if (is_uploaded_file($image)) {
     if ($image_size < 100000) {
         $allowed_extensions = array("jpg", "png", "jpe", "jpeg", "gif");
         if (in_array($type, $allowed_extensions) and $image_name) {
             include_once ENGINE_DIR . '/classes/thumb.class.php';
             $res = @move_uploaded_file($image, ROOT_DIR . "/uploads/fotos/" . $id . "." . $type);
             if ($res) {
                 @chmod(ROOT_DIR . "/uploads/fotos/" . $id . "." . $type, 0666);
                 $thumb = new thumbnail(ROOT_DIR . "/uploads/fotos/" . $id . "." . $type);
                 if ($thumb->size_auto($user_group[$member_id['user_group']]['max_foto'])) {
                     $thumb->jpeg_quality($config['jpeg_quality']);
                     $thumb->save(ROOT_DIR . "/uploads/fotos/foto_" . $id . "." . $type);
                 } else {
                     @rename(ROOT_DIR . "/uploads/fotos/" . $id . "." . $type, ROOT_DIR . "/uploads/fotos/foto_" . $id . "." . $type);
                 }
                 @chmod(ROOT_DIR . "/uploads/fotos/foto_" . $id . "." . $type, 0666);
                 $foto_name = "foto_" . $id . "." . $type;
                 $db->query("UPDATE " . USERPREFIX . "_users set foto='{$foto_name}' WHERE user_id='{$id}'");
             }
         }
     }
     @unlink(ROOT_DIR . "/uploads/fotos/" . $id . "." . $type);
 }
 if ($_POST['del_foto'] == "yes") {
     $row = $db->super_query("SELECT foto FROM " . USERPREFIX . "_users WHERE user_id='{$id}'");
     $db->query("UPDATE " . USERPREFIX . "_users set foto='' WHERE user_id='{$id}'");
     @unlink(ROOT_DIR . "/uploads/fotos/" . $row['foto']);
 function FileUpload()
 {
     global $config, $db, $lang, $member_id, $user_group;
     $_IP = get_ip();
     $added_time = time() + $config['date_adjust'] * 60;
     if (!is_dir(ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX)) {
         @mkdir(ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX, 0777);
         @chmod(ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX, 0777);
         @mkdir(ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX . "thumbs", 0777);
         @chmod(ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX . "thumbs", 0777);
     }
     if (!is_dir(ROOT_DIR . "/uploads/files/" . FOLDER_PREFIX)) {
         @mkdir(ROOT_DIR . "/uploads/files/" . FOLDER_PREFIX, 0777);
         @chmod(ROOT_DIR . "/uploads/files/" . FOLDER_PREFIX, 0777);
     }
     if (!is_dir(ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX)) {
         return $this->msg_error($lang['upload_error_0'] . " /uploads/posts/" . FOLDER_PREFIX, 403);
     }
     if (!is_dir(ROOT_DIR . "/uploads/files/" . FOLDER_PREFIX)) {
         return $this->msg_error($lang['upload_error_0'] . " /uploads/files/" . FOLDER_PREFIX, 403);
     }
     if (!is_writable(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX)) {
         return $this->msg_error($lang['upload_error_1'] . " /uploads/" . $this->upload_path . FOLDER_PREFIX . " " . $lang['upload_error_2'], 403);
     }
     if (!is_writable(ROOT_DIR . "/uploads/files/" . FOLDER_PREFIX)) {
         return $this->msg_error($lang['upload_error_1'] . " /uploads/files/" . FOLDER_PREFIX . " " . $lang['upload_error_2'], 403);
     }
     if (!is_writable(ROOT_DIR . "/uploads/posts/" . FOLDER_PREFIX . "thumbs")) {
         return $this->msg_error($lang['upload_error_1'] . " /uploads/posts/" . FOLDER_PREFIX . "thumbs/ " . $lang['upload_error_2'], 403);
     }
     if (!$this->file) {
         return $this->msg_error($lang['upload_error_3'], 405);
     }
     $filename = $this->check_filename($this->file->getFileName());
     $size = $this->file->getFileSize();
     if (!$filename) {
         return $this->msg_error($lang['upload_error_4'], 405);
     }
     $filename_arr = explode(".", $filename);
     $type = end($filename_arr);
     if (!$type) {
         return $this->msg_error($lang['upload_error_4'], 405);
     }
     $error_code = $this->file->getErrorCode();
     if ($error_code) {
         return $this->msg_error($error_code, 405);
     }
     if ($size == 0) {
         return $this->msg_error($lang['upload_error_5'], 403);
     }
     if ($config['files_allow'] == "yes" and $user_group[$member_id['user_group']]['allow_file_upload'] and in_array($type, $this->allowed_files)) {
         if (intval($user_group[$member_id['user_group']]['max_file_size']) and $size > $user_group[$member_id['user_group']]['max_file_size'] * 1024) {
             return $this->msg_error($lang['files_too_big'], 500);
         }
         if ($this->area != "template" and $user_group[$member_id['user_group']]['max_files']) {
             $row = $db->super_query("SELECT COUNT(*) as count  FROM " . PREFIX . "_files WHERE author = '{$this->author}' AND news_id = '{$this->news_id}'");
             $count_files = $row['count'];
             if ($count_files and $count_files >= $user_group[$member_id['user_group']]['max_files']) {
                 return $this->msg_error($lang['error_max_files'], 403);
             }
         }
         $uploaded_filename = $this->file->saveFile(ROOT_DIR . "/uploads/files/" . FOLDER_PREFIX, $filename, $this->use_prefix);
         if ($uploaded_filename) {
             @chmod(ROOT_DIR . "/uploads/files/" . FOLDER_PREFIX . $uploaded_filename, 0666);
             $added_time = time() + $config['date_adjust'] * 60;
             if ($user_group[$member_id['user_group']]['allow_admin']) {
                 $db->query("INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('" . $db->safesql($member_id['name']) . "', '{$added_time}', '{$_IP}', '36', '{$uploaded_filename}')");
             }
             if ($this->area == "template") {
                 $db->query("INSERT INTO " . PREFIX . "_static_files (static_id, author, date, name, onserver) values ('{$this->news_id}', '{$this->author}', '{$added_time}', '{$filename}', '" . FOLDER_PREFIX . "{$uploaded_filename}')");
                 $id = $db->insert_id();
                 if (in_array($type, $this->allowed_video)) {
                     if ($type == "mp3") {
                         $file_link = $config['http_home_url'] . "engine/skins/images/mp3_file.png";
                         $data_url = $config['http_home_url'] . "uploads/files/" . FOLDER_PREFIX . $uploaded_filename;
                         $file_play = "audio";
                     } elseif ($type == "swf") {
                         $file_link = $config['http_home_url'] . "engine/skins/images/file_flash.png";
                         $data_url = $config['http_home_url'] . "uploads/files/" . FOLDER_PREFIX . $uploaded_filename;
                         $file_play = "flash";
                     } else {
                         $file_link = $config['http_home_url'] . "engine/skins/images/video_file.png";
                         $data_url = $config['http_home_url'] . "uploads/files/" . FOLDER_PREFIX . $uploaded_filename;
                         $file_play = "video";
                     }
                 } else {
                     $file_link = $config['http_home_url'] . "engine/skins/images/all_file.png";
                     $data_url = "#";
                     $file_play = "";
                 }
                 $return_box = "<div class=\"uploadedfile\"><div class=\"info\">{$filename}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$id}:{$filename}\" data-type=\"file\" data-play=\"{$file_play}\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $file_link . "\" /></a></div><div class=\"info\"><input type=\"checkbox\" id=\"file\" name=\"static_files[]\" value=\"{$id}\" data-type=\"file\">&nbsp;" . formatsize($size) . "</div></div>";
             } else {
                 $db->query("INSERT INTO " . PREFIX . "_files (news_id, name, onserver, author, date) values ('{$this->news_id}', '{$filename}', '" . FOLDER_PREFIX . "{$uploaded_filename}', '{$this->author}', '{$added_time}')");
                 $id = $db->insert_id();
                 if (in_array($type, $this->allowed_video)) {
                     if ($type == "mp3") {
                         $file_link = $config['http_home_url'] . "engine/skins/images/mp3_file.png";
                         $data_url = $config['http_home_url'] . "uploads/files/" . FOLDER_PREFIX . $uploaded_filename;
                         $file_play = "audio";
                     } elseif ($type == "swf") {
                         $file_link = $config['http_home_url'] . "engine/skins/images/file_flash.png";
                         $data_url = $config['http_home_url'] . "uploads/files/" . FOLDER_PREFIX . $uploaded_filename;
                         $file_play = "flash";
                     } else {
                         $file_link = $config['http_home_url'] . "engine/skins/images/video_file.png";
                         $data_url = $config['http_home_url'] . "uploads/files/" . FOLDER_PREFIX . $uploaded_filename;
                         $file_play = "video";
                     }
                 } else {
                     $file_link = $config['http_home_url'] . "engine/skins/images/all_file.png";
                     $data_url = "#";
                     $file_play = "";
                 }
                 $return_box = "<div class=\"uploadedfile\"><div class=\"info\">{$filename}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$id}:{$filename}\" data-type=\"file\" data-play=\"{$file_play}\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $file_link . "\" /></a></div><div class=\"info\"><input type=\"checkbox\" id=\"file\" name=\"files[]\" value=\"{$id}\" data-type=\"file\">&nbsp;" . formatsize($size) . "</div></div>";
             }
         } else {
             return $this->msg_error($lang['images_uperr_3'], 403);
         }
     } elseif (in_array($type, $this->allowed_extensions) and $user_group[$member_id['user_group']]['allow_image_upload']) {
         if (intval($config['max_up_size']) and $size > $config['max_up_size'] * 1024 and !$config['max_up_side']) {
             return $this->msg_error($lang['images_big'], 500);
         }
         if ($this->area != "template" and $this->area != "adminupload" and $user_group[$member_id['user_group']]['max_images']) {
             $row = $db->super_query("SELECT images  FROM " . PREFIX . "_images WHERE author = '{$this->author}' AND news_id = '{$this->news_id}'");
             if ($row['images']) {
                 $count_images = count(explode("|||", $row['images']));
             } else {
                 $count_images = false;
             }
             if ($count_images and $count_images >= $user_group[$member_id['user_group']]['max_images']) {
                 return $this->msg_error($lang['error_max_images'], 403);
             }
         }
         $uploaded_filename = $this->file->saveFile(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX, $filename, $this->use_prefix);
         if ($uploaded_filename) {
             $added_time = time() + $config['date_adjust'] * 60;
             @chmod(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename, 0666);
             $i_info = @getimagesize(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename);
             if (!in_array($i_info[2], array(1, 2, 3))) {
                 @unlink(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename);
                 return $this->msg_error($lang['upload_error_6'], 500);
             }
             $thumb = new thumbnail(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename);
             if ($this->area != "template" and $this->area != "adminupload") {
                 $row = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_images WHERE news_id = '{$this->news_id}' AND author = '{$this->author}'");
                 if (!$row['count']) {
                     $inserts = FOLDER_PREFIX . $uploaded_filename;
                     $db->query("INSERT INTO " . PREFIX . "_images (images, author, news_id, date) values ('{$inserts}', '{$this->author}', '{$this->news_id}', '{$added_time}')");
                 } else {
                     $row = $db->super_query("SELECT images  FROM " . PREFIX . "_images WHERE news_id = '{$this->news_id}' AND author = '{$this->author}'");
                     if ($row['images'] == "") {
                         $listimages = array();
                     } else {
                         $listimages = explode("|||", $row['images']);
                     }
                     foreach ($listimages as $dataimages) {
                         if ($dataimages == FOLDER_PREFIX . $uploaded_filename) {
                             $error_image = "stop";
                         }
                     }
                     if ($error_image != "stop") {
                         $listimages[] = FOLDER_PREFIX . $uploaded_filename;
                         $row['images'] = implode("|||", $listimages);
                         $db->query("UPDATE " . PREFIX . "_images SET images='{$row['images']}' WHERE news_id = '{$this->news_id}' AND author = '{$this->author}'");
                     }
                 }
             }
             if ($this->area == "template") {
                 $inserts = FOLDER_PREFIX . $uploaded_filename;
                 $db->query("INSERT INTO " . PREFIX . "_static_files (static_id, author, date, name) values ('{$this->news_id}', '{$this->author}', '{$added_time}', '{$inserts}')");
                 $id = $db->insert_id();
             }
             if ($user_group[$member_id['user_group']]['allow_admin']) {
                 $db->query("INSERT INTO " . USERPREFIX . "_admin_logs (name, date, ip, action, extras) values ('" . $db->safesql($member_id['name']) . "', '{$added_time}', '{$_IP}', '36', '{$uploaded_filename}')");
             }
             if ($this->make_thumb) {
                 if ($thumb->size_auto($this->t_size, $this->t_seite)) {
                     $thumb->jpeg_quality($config['jpeg_quality']);
                     if ($this->make_watermark) {
                         $thumb->insert_watermark($config['max_watermark']);
                     }
                     $thumb->save(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . "thumbs/" . $uploaded_filename);
                     @chmod(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . "thumbs/" . $uploaded_filename, 0666);
                 }
             }
             if ($member_id['user_group'] == 1) {
                 if ($this->make_watermark or $config['max_up_side']) {
                     $thumb = new thumbnail(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename);
                     $thumb->jpeg_quality($config['jpeg_quality']);
                     $re_save = false;
                     if (intval($config['max_up_side']) > 1 and $thumb->size_auto($config['max_up_side'], $config['o_seite'])) {
                         $re_save = true;
                     }
                     if ($this->make_watermark) {
                         $thumb->insert_watermark($config['max_watermark']);
                         $re_save = true;
                     }
                     if ($re_save) {
                         $thumb->save(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename);
                     }
                 }
             } else {
                 $thumb = new thumbnail(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename);
                 $thumb->jpeg_quality($config['jpeg_quality']);
                 if ($config['max_up_side']) {
                     $thumb->size_auto($config['max_up_side'], $config['o_seite']);
                 }
                 if ($this->make_watermark) {
                     $thumb->insert_watermark($config['max_watermark']);
                 }
                 $thumb->save(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename);
             }
             if ($config['max_up_side']) {
                 $i_info = @getimagesize(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename);
             }
             if (file_exists(ROOT_DIR . "/uploads/" . $this->upload_path . FOLDER_PREFIX . "thumbs/" . $uploaded_filename)) {
                 $img_url = $config['http_home_url'] . "uploads/" . $this->upload_path . FOLDER_PREFIX . "thumbs/" . $uploaded_filename;
                 $thumb_data = "yes";
             } else {
                 $img_url = $config['http_home_url'] . "uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename;
                 $thumb_data = "no";
             }
             $data_url = $config['http_home_url'] . "uploads/" . $this->upload_path . FOLDER_PREFIX . $uploaded_filename;
             if ($this->area != "template") {
                 $return_box = "<div class=\"uploadedfile\"><div class=\"info\">{$filename}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$data_url}\" data-thumb=\"{$thumb_data}\" data-type=\"image\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $img_url . "\" /></a></div><div class=\"info\"><input type=\"checkbox\" name=\"images[" . FOLDER_PREFIX . $uploaded_filename . "]\" value=\"" . FOLDER_PREFIX . $uploaded_filename . "\" data-thumb=\"{$thumb_data}\" data-type=\"image\" data-src=\"{$data_url}\">&nbsp;{$i_info[0]}x{$i_info[1]}</div></div>";
             } else {
                 $return_box = "<div class=\"uploadedfile\"><div class=\"info\">{$filename}</div><div class=\"uploadimage\"><a class=\"uploadfile\" href=\"{$data_url}\" data-src=\"{$data_url}\" data-thumb=\"{$thumb_data}\" data-type=\"image\"><img style=\"width:auto;height:auto;max-width:100px;max-height:90px;\" src=\"" . $img_url . "\" /></a></div><div class=\"info\"><input type=\"checkbox\" name=\"static_files[]\" value=\"{$id}\" data-thumb=\"{$thumb_data}\" data-type=\"image\" data-src=\"{$data_url}\">&nbsp;{$i_info[0]}x{$i_info[1]}</div></div>";
             }
         } else {
             return $this->msg_error($lang['images_uperr_3'], 403);
         }
     } else {
         return $this->msg_error($lang['images_uperr_2'], 403);
     }
     $return_box = addcslashes($return_box, "\t\n\r\"\\/");
     return htmlspecialchars("{\"success\":true, \"returnbox\":\"{$return_box}\"}", ENT_NOQUOTES, $config['charset']);
 }
Example #5
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 #6
0
     //Покачто закомментировал т.к. на локалке работает всё нормально, нужно проверять на хостинге.
     /*$url = explode('/uploads/', $url);
     		if(count($url) != 2) continue; // да ну нафиг, если в нескольких папках uploads					
     		$url = ROOT_DIR . '/uploads/' . $url[1];				
     		if(!is_file($url))  continue;*/
     $info = pathinfo($url);
     if (isset($info['extension'])) {
         $info['extension'] = strtolower($info['extension']);
         if (in_array($info['extension'], array('jpg', 'jpeg', 'gif', 'png'))) {
             $original_img = str_replace(ROOT_DIR, '', $url);
             $file_name = strtolower(basename($url));
             $file_name = $img_size . "_" . $file_name;
             if (!file_exists($dir . $file_name)) {
                 $thumb = new thumbnail($url);
                 $thumb->size_auto($img_size);
                 $thumb->save($dir . $file_name);
             }
             if ($img_size == 0) {
                 $image[] = $original_img;
             } else {
                 $image[] = $config['http_home_url'] . "uploads/blockpro/" . $file_name;
             }
         }
     }
 }
 if (count($image)) {
     $i = 0;
     foreach ($image as $url) {
         $i++;
         $tplb->copy_template = str_replace('{image-' . $i . '}', $url, $tplb->copy_template);
     }
Example #7
0
function image_upload_process_handler()
{
    global $db, $smarty, $main_smarty, $linkres;
    include_once 'image_upload_settings.php';
    $module_error = false;
    // Debug Info
    image_upload_printdebug("START: image_upload_process_handler.");
    // Get the image real name, temp name, submission ID
    $imageFilename = $_FILES[module_imageupload_filename_field]['name'];
    $sourceFile = $_FILES[module_imageupload_filename_field]['tmp_name'];
    if ($sourceFile != "") {
        if (isset($_POST['id'])) {
            $linkID = strip_tags($_POST['id']);
        } else {
            $module_error = true;
            $module_errors[] = "- Submission entry id not found.";
        }
        // Get new names
        $destFile = module_imageupload_fullsize_prefix . $linkID;
        $destPath = module_imageupload_basedir . module_imageupload_imagedir;
        // Get image dimensions
        $thisImage = getimagesize($sourceFile);
        $thisImageFileSize = filesize($sourceFile);
        $thisImageWidth = $thisImage[0];
        $thisImageHeight = $thisImage[1];
        $thisImageMimeType = $thisImage['mime'];
        // Debug Info
        image_upload_printdebug("Original image filename = " . $imageFilename);
        image_upload_printdebug("Temp image filename = " . $sourceFile);
        image_upload_printdebug("Link ID = " . $linkID);
        image_upload_printdebug("Raw File size = " . $thisImageFileSize);
        image_upload_printdebug("Formatted File size = " . formatbytes($thisImageFileSize));
        image_upload_printdebug("Max allowed file size = " . module_imageupload_upload_maxsize * 1000 * 1000);
        image_upload_printdebug("Max allowed image x height = " . module_imageupload_upload_maxwidth . "x" . module_imageupload_upload_maxheight);
        image_upload_printdebug("Destination file = " . $destFile);
        image_upload_printdebug("Destination path = " . $destPath);
        image_upload_printdebug("Image data = " . $thisImageWidth . "x" . $thisImageHeight . " (" . $thisImageMimeType . ")");
        // Test image against max width / height constraints
        if ($thisImageWidth > module_imageupload_upload_maxwidth || $thisImageHeight > module_imageupload_upload_maxheight) {
            $module_error = true;
            $module_errors[] = "- This image exceeds the " . module_imageupload_upload_maxwidth . "x" . module_imageupload_upload_maxheight . " (width x height) maximum.";
        }
        // Test image against max file size constraints
        if ($thisImageFileSize > module_imageupload_upload_maxsize * 1000 * 1000) {
            $module_error = true;
            $module_errors[] = "- This image exceeds the allowed file size of " . module_imageupload_upload_maxsize . "MB";
        }
        // Determine Mime Type
        if (!$module_error) {
            switch ($thisImageMimeType) {
                case "image/jpeg":
                    $module_error = false;
                    $tempExt = ".jpg";
                    break;
                case "image/gif":
                    $module_error = false;
                    $tempExt = ".gif";
                    break;
                case "image/png":
                    $module_error = false;
                    $tempExt = ".png";
                    break;
                case "image/wbmp":
                    $module_error = false;
                    $tempExt = ".wbmp";
                    break;
                default:
                    if ($imageAttached) {
                        $module_error = true;
                        $module_errors[] = "- Unknown image type.  Only JPG, PNG, GIF and WMBP allowed.";
                    }
            }
        }
        // Process file, remove re-posts, and convert if necessary
        if (!$module_error) {
            if (file_exists($destPath . $destFile . $tempExt)) {
                @unlink($destPath . $destFile . $tempExt);
            }
            // Convert image if not JPG
            switch ($thisImageMimeType) {
                case "image/jpeg":
                    // No conversion needed
                    // Debug Info
                    image_upload_printdebug("No image conversion necessary.");
                    if (!move_uploaded_file($sourceFile, $destPath . $destFile . $tempExt)) {
                        $module_error = true;
                        $module_errors[] = "- Error processing image.";
                        // Delete original
                        @unlink($destPath . $destFile . $tempExt);
                    }
                    break;
                case "image/gif":
                case "image/png":
                case "image/wbmp":
                    // Include image converter class
                    @(include_once 'plugins/class.imageconverter.inc.php');
                    // Debug Info
                    image_upload_printdebug("Conversion of image file beginning...");
                    if (move_uploaded_file($sourceFile, $destPath . $destFile . $tempExt)) {
                        $tempDest = $destPath . $destFile . $tempExt;
                        // Convert image to JPG
                        $img = new ImageConverter($tempDest, "jpg", $destPath);
                        @unlink($tempDest);
                        // Get converted image dimensions
                        $destImage = getimagesize($destPath . $destFile . ".jpg");
                        $destImageWidth = $destImage[0];
                        $destImageHeight = $destImage[1];
                        $destImageMimeType = $destImage['mime'];
                        @unlink($tempDest);
                        // Debug Info
                        image_upload_printdebug("Dest Filename = " . $destPath . $destFile . ".jpg");
                        image_upload_printdebug("Dest image width = " . $destImageWidth);
                        image_upload_printdebug("Dest image height = " . $destImageHeight);
                        image_upload_printdebug("Dest image mime type = " . $destImageMimeType);
                    } else {
                        // Debug Info
                        image_upload_printdebug("Unable to move source file to dest for conversion.  Deleting source file.");
                        $module_error = true;
                        $module_error_message = module_imageupload_errorcode_2;
                        // Delete original
                        @unlink($sourceFile);
                    }
                    break;
            }
        }
        // Check if we need to resize image to meet fullsize width or height setting
        if (!$module_error) {
            // Debug Info
            image_upload_printdebug("Checking image dimensions for possible resizing.");
            $destFile .= ".jpg";
            # Check to see if the image needs to be rescaled.
            switch (module_imageupload_fullsize_maxtoggle) {
                case "w":
                    if ($thisImageWidth > module_imageupload_fullsize_width) {
                        // Include image resize functions
                        include_once 'plugins/class.thumbnail.inc.php';
                        // Debug Info
                        image_upload_printdebug("Image is wider than setting, attempting to reduce.");
                        image_upload_printdebug("Dest Path = " . $destPath);
                        image_upload_printdebug("Dest File = " . $destFile);
                        $convertImage = new thumbnail($destPath . $destFile);
                        $convertImage->size_auto(module_imageupload_fullsize_width);
                        $convertImage->jpeg_quality(module_imageupload_jpg_quality);
                        $convertImage->save($destPath . $destFile, module_imageupload_gdversion);
                        $destImage = getimagesize($destPath . $destFile);
                        $destImageWidth = $destImage[0];
                        $destImageHeight = $destImage[1];
                        // Debug Info
                        image_upload_printdebug("Converted image is " . $destImageWidth . "x" . $destImageHeight);
                    }
                    break;
                case "h":
                    if ($thisImageHeight > module_imageupload_fullsize_height) {
                        // Include image resize functions
                        include_once 'plugins/class.thumbnail.inc.php';
                        // Debug Info
                        image_upload_printdebug("Image is taller than setting, attempting to reduce.");
                        image_upload_printdebug("Dest Path = " . $destPath);
                        image_upload_printdebug("Dest File = " . $destFile);
                        $convertImage = new thumbnail($destPath . $destFile);
                        $convertImage->size_auto(module_imageupload_fullsize_height);
                        $convertImage->jpeg_quality(module_imageupload_jpg_quality);
                        $convertImage->save($destPath . $destFile, module_imageupload_gdversion);
                        getimagesize($destPath . $destFile);
                        $destImageWidth = $destImage[0];
                        $destImageHeight = $destImage[1];
                        // Debug Info
                        image_upload_printdebug("Converted image is " . $destImageWidth . "x" . $destImageHeight);
                    }
                    break;
            }
        }
        if (!$module_error) {
            // Debug Info
            image_upload_printdebug("Updating database with image filename.");
            // Update database
            $db->query("UPDATE " . table_links . " set " . module_imageupload_filename_field . "='{$destFile}' WHERE link_id='{$linkID}'");
            if (module_imageupload_customcaptions) {
                // Debug Info
                image_upload_printdebug("Using custom image caption.");
                $imageCaption = $_POST[module_imageupload_caption_field];
                if ($imageCaption != "") {
                    // Debug Info
                    image_upload_printdebug("Custom image caption: " . $imageCaption);
                    $imageCaption = strip_tags($imageCaption);
                    $imageCaption = addslashes($imageCaption);
                    // Debug Info
                    image_upload_printdebug('Updating database with custom image caption');
                    // Update database
                    $db->query("UPDATE " . table_links . " set " . module_imageupload_caption_field . "='" . $imageCaption . "' WHERE link_id='{$linkID}'");
                }
            }
            // Debug Info
            image_upload_printdebug("Database updated.");
        } else {
            @unlink($sourceFile);
            @unlink($destPath . $destFile . ".jpg");
            // Output error messages
            image_upload_printerrors($module_errors);
        }
    }
    // Debug Info
    image_upload_printdebug("END: image_upload_process_handler.");
}
    $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 #9
0
         // имя фотографии
         $image_size = $_FILES['uploadfile']['size'];
         // размер файла
         $type = end(explode(".", $image_name));
         // формат файла
         if (in_array($type, $allowed_files)) {
             if ($image_size < 5000000) {
                 $res_type = '.' . $type;
                 $uploaddir = ROOT_DIR . '/uploads/apps/' . $id . '/';
                 // Директория куда загружать
                 if (move_uploaded_file($image_tmp, $uploaddir . $image_rename . $res_type)) {
                     //Создание уменьшеной копии 100х100
                     $tmb = new thumbnail($uploaddir . $image_rename . $res_type);
                     $tmb->size_auto('100x100');
                     $tmb->jpeg_quality(97);
                     $tmb->save($uploaddir . '100_' . $image_rename . $res_type);
                     $image_rename = $db->safesql($image_rename);
                     $res_type = $db->safesql($res_type);
                     $db->query("UPDATE `" . PREFIX . "_apps` SET `img`='{$image_rename}{$res_type}' WHERE `id`='{$id}'");
                     echo $config['home_url'] . 'uploads/apps/' . $id . '/100_' . $image_rename . $res_type;
                 } else {
                     echo 'bad';
                 }
             } else {
                 echo 'big_size';
             }
         } else {
             echo 'bad_format';
         }
         break;
 }
Example #10
0
function register_user($social_user)
{
    global $db, $config, $user_group, $popup, $js_popup, $lang;
    $add_time = time();
    $_IP = get_ip();
    if (intval($config['reg_group']) < 3) {
        $config['reg_group'] = 4;
    }
    if (function_exists('openssl_random_pseudo_bytes') && (version_compare(PHP_VERSION, '5.3.4') >= 0 || strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) {
        $stronghash = openssl_random_pseudo_bytes(15);
    } else {
        $stronghash = md5(uniqid(mt_rand(), TRUE));
    }
    $salt = str_shuffle("abchefghjkmnpqrstuvwxyz0123456789" . sha1($stronghash . microtime()));
    $password = '';
    $hash = '';
    for ($i = 0; $i < 11; $i++) {
        $password .= $salt[GetRandInt(72)];
    }
    $password = md5($password);
    if ($config['log_hash']) {
        for ($i = 0; $i < 9; $i++) {
            $hash .= $salt[GetRandInt(72)];
        }
    }
    $social_user['nickname'] = $db->safesql($social_user['nickname']);
    $social_user['email'] = $db->safesql($social_user['email']);
    $social_user['name'] = $db->safesql($social_user['name']);
    $db->query("INSERT INTO " . USERPREFIX . "_users (name, password, email, reg_date, lastdate, user_group, info, signature, fullname, favorites, xfields, hash, logged_ip) VALUES ('{$social_user['nickname']}', '" . md5($password) . "', '{$social_user['email']}', '{$add_time}', '{$add_time}', '{$config['reg_group']}', '', '', '{$social_user['name']}', '', '', '{$hash}', '{$_IP}')");
    $id = $db->insert_id();
    $db->query("INSERT INTO " . USERPREFIX . "_social_login (sid, uid, password, provider, wait) VALUES ('{$social_user['sid']}', '{$id}', '{$password}', '{$social_user['provider']}', '0')");
    set_cookie("dle_user_id", $id, 365);
    set_cookie("dle_password", $password, 365);
    if ($config['log_hash']) {
        set_cookie("dle_hash", $hash, 365);
    }
    $_SESSION['dle_user_id'] = $id;
    $_SESSION['dle_password'] = $password;
    $_SESSION['state'] = 0;
    if (intval($user_group[$config['reg_group']]['max_foto']) > 0 and $social_user['avatar']) {
        $n_array = explode(".", $social_user['avatar']);
        $type = end($n_array);
        $type = totranslit($type);
        $allowed_extensions = array("jpg", "png", "gif");
        if (in_array($type, $allowed_extensions)) {
            include_once ENGINE_DIR . '/classes/thumb.class.php';
            if (@copy($social_user['avatar'], ROOT_DIR . "/uploads/fotos/" . $id . "." . $type)) {
                @chmod(ROOT_DIR . "/uploads/fotos/" . $id . "." . $type, 0666);
                $thumb = new thumbnail(ROOT_DIR . "/uploads/fotos/" . $id . "." . $type);
                $thumb->size_auto($user_group[$config['reg_group']]['max_foto']);
                $thumb->jpeg_quality($config['jpeg_quality']);
                $thumb->save(ROOT_DIR . "/uploads/fotos/foto_" . $id . "." . $type);
                @unlink(ROOT_DIR . "/uploads/fotos/" . $id . "." . $type);
                $foto_name = "foto_" . $id . "." . $type;
                $db->query("UPDATE " . USERPREFIX . "_users SET foto='{$foto_name}' WHERE user_id='{$id}'");
            }
        }
    }
    echo str_replace("{text}", $lang['social_login_ok'] . $js_popup, $popup);
    die;
}
Example #11
0
         if ($_POST['pos'] == 'right') {
             $degrees = -90;
         }
         if ($_POST['pos'] == 'left') {
             $degrees = 90;
         }
         $source = imagecreatefromjpeg($filename);
         $rotate = imagerotate($source, $degrees, 0);
         imagejpeg($rotate, ROOT_DIR . '/uploads/users/' . $user_id . '/albums/' . $row['album_id'] . '/' . $row['photo_name'], 93);
         //Подключаем класс для фотографий
         include ENGINE_DIR . '/classes/images.php';
         //Создание маленькой копии
         $tmb = new thumbnail(ROOT_DIR . '/uploads/users/' . $user_id . '/albums/' . $row['album_id'] . '/' . $row['photo_name']);
         $tmb->size_auto('140x100');
         $tmb->jpeg_quality('100');
         $tmb->save(ROOT_DIR . '/uploads/users/' . $user_id . '/albums/' . $row['album_id'] . '/c_' . $row['photo_name']);
         echo '/uploads/users/' . $user_id . '/albums/' . $row['album_id'] . '/' . $row['photo_name'];
     }
     break;
 default:
     //################### Просмотр фотографии ###################//
     NoAjaxQuery();
     $user_id = intval($_POST['uid']);
     $photo_id = intval($_POST['pid']);
     $fuser = intval($_POST['fuser']);
     $section = $_POST['section'];
     //ЧС
     $CheckBlackList = CheckBlackList($user_id);
     if (!$CheckBlackList) {
         //Получаем ID альбома
         $check_album = $db->super_query("SELECT album_id FROM `" . PREFIX . "_photos` WHERE id = '{$photo_id}'");
     $i_width = intval($_POST['i_width']);
     $i_height = intval($_POST['i_height']);
     if ($row['user_photo'] and $i_width >= 100 and $i_height >= 100 and $i_left >= 0 and $i_height >= 0) {
         include_once ENGINE_DIR . '/classes/images.php';
         $tmb = new thumbnail(ROOT_DIR . "/uploads/users/{$user_info['user_id']}/{$row['user_photo']}");
         $tmb->size_auto($i_width . "x" . $i_height, 0, "{$i_left}|{$i_top}");
         $tmb->jpeg_quality(100);
         $tmb->save(ROOT_DIR . "/uploads/users/{$user_info['user_id']}/100_{$row['user_photo']}");
         $tmb = new thumbnail(ROOT_DIR . "/uploads/users/{$user_info['user_id']}/100_{$row['user_photo']}");
         $tmb->size_auto("100x100", 1);
         $tmb->jpeg_quality(100);
         $tmb->save(ROOT_DIR . "/uploads/users/{$user_info['user_id']}/100_{$row['user_photo']}");
         $tmb = new thumbnail(ROOT_DIR . "/uploads/users/{$user_info['user_id']}/100_{$row['user_photo']}");
         $tmb->size_auto("50x50");
         $tmb->jpeg_quality(100);
         $tmb->save(ROOT_DIR . "/uploads/users/{$user_info['user_id']}/50_{$row['user_photo']}");
         echo $user_info['user_id'];
     } else {
         echo 'err';
     }
     exit;
     break;
 default:
     //Страница Редактирование основное
     $user_speedbar = $lang['editmyprofile'] . ' &raquo; ' . $lang['editmyprofile_genereal'];
     $tpl->load_template('editprofile.tpl');
     $row = $db->super_query("SELECT user_name, user_lastname, user_sex, user_day, user_month, user_year, user_country, user_city, user_sp FROM `" . PREFIX . "_users` WHERE user_id = '{$user_info['user_id']}'");
     $tpl->set('{name}', $row['user_name']);
     $tpl->set('{lastname}', $row['user_lastname']);
     $tpl->set('{sex}', installationSelected($row['user_sex'], '<option value="1">мужской</option><option value="2">женский</option>'));
     $tpl->set('{user-day}', installationSelected($row['user_day'], '<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option><option value="25">25</option><option value="26">26</option><option value="27">27</option><option value="28">28</option><option value="29">29</option><option value="30">30</option><option value="31">31</option>'));
Example #13
0
 public function addCover($field, $dir = false)
 {
     global $settings;
     if (!$dir) {
         global $coverpath;
         $dir = $coverpath;
     }
     $bestand = $dir . $this->id . ".jpg";
     // Is it jpg or png?
     $extentie = strtolower(findExtention($_FILES[$field]["name"]));
     if ($extentie != "jpg") {
         return false;
     }
     // Remove old file
     if (file_exists($bestand)) {
         unlink($bestand);
     }
     // Copy
     copy($_FILES[$field]["tmp_name"], $bestand);
     // Thumbnail
     $thumb = new thumbnail($bestand);
     $thumb->size_width($settings["photo"]["tn_maxwidth"]);
     $thumb->jpeg_quality(100);
     $thumb->save($dir . "tn_" . $this->id . ".jpg");
 }
Example #14
0
         mkdir("FOTOS/EINHEIT/{$e->einheit_kurzname}/ANZEIGE", 0777);
     } else {
         // echo "OK ANZ ORDNERA";
     }
     /* Bisher alles ok */
     if (file_exists("FOTOS/EINHEIT/{$e->einheit_kurzname}/ANZEIGE")) {
         // $kopiert = copy($orig_file, $newname);
         if (file_exists($orig_file)) {
             // echo "tempfile da";
             // die();
             $thumbnail = new thumbnail();
             $thumbnail->create($orig_file);
             $thumbnail->setQuality(80);
             $thumbnail->resize("1024");
             // $thumbnail->output();
             $thumbnail->save($orig_file, true);
             // die();
             if (!move_uploaded_file($orig_file, $newname)) {
                 fehlermeldung_ausgeben("Datei {$orig_file} {$newname} konnte nicht kopiert werden");
             } else {
                 echo "{$orig_filename} hochgeladen";
                 // echo "OK Datei $orig_filename $newname aus temp verschoben!";
             }
         }
     } else {
         // echo "ORDNER EXISTIERT NICHT und konnte nicht angelegt werden $orig_file";
         mkdir("FOTOS/EINHEIT/{$e->einheit_kurzname}/ANZEIGE", 0777);
     }
 } else {
     echo "No file sent ...";
 }
Example #15
0
             //Загружаем картинку на сайт
             if (in_array(strtolower($img_format), $allowed_files) and preg_match("/http:\\/\\/(.*?)(.jpg|.png|.gif|.jpeg|.jpe)/i", $rImgUrl)) {
                 //Директория загрузки фото
                 $upload_dir = ROOT_DIR . '/uploads/attach/' . $user_id;
                 //Если нет папки юзера, то создаём её
                 if (!is_dir($upload_dir)) {
                     @mkdir($upload_dir, 0777);
                     @chmod($upload_dir, 0777);
                 }
                 //Подключаем класс для фотографий
                 include ENGINE_DIR . '/classes/images.php';
                 if (@copy($rImgUrl, $upload_dir . '/' . $image_name . '.' . $img_format)) {
                     $tmb = new thumbnail($upload_dir . '/' . $image_name . '.' . $img_format);
                     $tmb->size_auto('100x80');
                     $tmb->jpeg_quality(100);
                     $tmb->save($upload_dir . '/' . $image_name . '.' . $img_format);
                     $attach_files = str_replace($attach_type[4], '/uploads/attach/' . $user_id . '/' . $image_name . '.' . $img_format, $attach_files);
                 }
             }
             $cnt_attach_link++;
         }
     }
 }
 $attach_files = str_replace('vote|', 'hack|', $attach_files);
 $attach_files = str_replace(array('&amp;#124;', '&amp;raquo;', '&amp;quot;'), array('&#124;', '&raquo;', '&quot;'), $attach_files);
 //Голосование
 $vote_title = ajax_utf8(textFilter($_POST['vote_title'], false, true));
 $vote_answer_1 = ajax_utf8(textFilter($_POST['vote_answer_1'], false, true));
 $ansers_list = array();
 if (isset($vote_title) and !empty($vote_title) and isset($vote_answer_1) and !empty($vote_answer_1)) {
     for ($vote_i = 1; $vote_i <= 10; $vote_i++) {
Example #16
0
 $config['max_photo_size'] = $config['max_photo_size'] * 1000;
 if ($image_size < $config['max_photo_size']) {
     $res_type = strtolower('.' . $type);
     if (move_uploaded_file($image_tmp, $album_dir . $image_rename . $res_type)) {
         //Подключаем класс для фотографий
         include ENGINE_DIR . '/classes/images.php';
         //Создание оригинала
         $tmb = new thumbnail($album_dir . $image_rename . $res_type);
         $tmb->size_auto('770');
         $tmb->jpeg_quality('85');
         $tmb->save($album_dir . $image_rename . $res_type);
         //Создание маленькой копии
         $tmb = new thumbnail($album_dir . $image_rename . $res_type);
         $tmb->size_auto('140x100');
         $tmb->jpeg_quality('90');
         $tmb->save($album_dir . 'c_' . $image_rename . $res_type);
         $date = date('Y-m-d H:i:s', $server_time);
         //Генерируем position фотки для "обзо фотографий"
         $position_all = $_SESSION['position_all'];
         if ($position_all) {
             $position_all = $position_all + 1;
             $_SESSION['position_all'] = $position_all;
         } else {
             $position_all = 100000;
             $_SESSION['position_all'] = $position_all;
         }
         //Вставляем фотографию
         $db->query("INSERT INTO `" . PREFIX . "_photos` (album_id, photo_name, user_id, date, position) VALUES ('{$aid}', '{$image_rename}{$res_type}', '{$user_id}', '{$date}', '{$position_all}')");
         $ins_id = $db->insert_id();
         //Проверяем на наличии обложки у альбома, если нету то ставим обложку загруженную фотку
         if (!$row['cover']) {
Example #17
0
// 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)
    {
        //detect image format
        $this->img["format"] = ereg_replace(".*\\.(.*)\$", "\\1", $imgfile);
        $this->img["format"] = strtoupper($this->img["format"]);
        if (!eregi('cache/', $imgfile)) {
            if ($this->img["format"] == "JPG" || $this->img["format"] == "JPEG") {
                //JPEG
                $this->img["format"] = "JPEG";