if (ceil($photo['width'] * $module_config[$module_name]['autologosize3'] / 100) > $logo_size[0]) { $w = $logo_size[0]; } else { $w = ceil($photo['width'] * $module_config[$module_name]['autologosize3'] / 100); } } $h = ceil($w * $logo_size[1] / $logo_size[0]); $x = $photo['width'] - $w - 5; $y = $photo['height'] - $h - 5; $config_logo = array(); $config_logo['x'] = $photo['width'] - $w - 5; $config_logo['y'] = $photo['height'] - $h - 5; $config_logo['w'] = $w; $config_logo['h'] = $h; $createImage = new NukeViet\Files\Image($newFilePath, NV_MAX_WIDTH, NV_MAX_HEIGHT); $createImage->addlogo(NV_ROOTDIR . '/' . $upload_logo, '', '', $config_logo); $createImage->save($folder_album, $basename); } $photo['file'] = substr($newFilePath, strlen(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/images/')); // Copy file thumb //$thum_folder = floor( $data['album_id'] / 1000 ); $thumbName = $fileName = substr($photo['thumb'], strlen(NV_BASE_SITEURL . NV_TEMP_DIR . '/')); $fileName2 = $fileName; $i = 1; while (file_exists(NV_ROOTDIR . '/' . $currentpaththumb . '/' . $fileName2)) { $fileName2 = preg_replace('/(.*)(\\.[a-zA-Z0-9]+)$/', '\\1_' . $i . '\\2', $fileName); ++$i; } $fileName = $fileName2; $filePath = NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $thumbName; $newFilePath = NV_ROOTDIR . '/' . $currentpaththumb . '/' . $fileName;
$config_logo['y'] = $file_size[1] - $h - 5; // Vertical: Bottom // Logo vertical if (preg_match("/^top/", $global_config['upload_logo_pos'])) { $config_logo['y'] = 5; } elseif (preg_match("/^center/", $global_config['upload_logo_pos'])) { $config_logo['y'] = round($file_size[1] / 2 - $h / 2); } // Logo horizontal if (preg_match("/Left\$/", $global_config['upload_logo_pos'])) { $config_logo['x'] = 5; } elseif (preg_match("/Center\$/", $global_config['upload_logo_pos'])) { $config_logo['x'] = round($file_size[0] / 2 - $w / 2); } $createImage = new NukeViet\Files\Image(NV_ROOTDIR . '/' . $path . '/' . $upload_info['basename'], NV_MAX_WIDTH, NV_MAX_HEIGHT); $createImage->addlogo(NV_ROOTDIR . '/' . $global_config['upload_logo'], '', '', $config_logo); $createImage->save(NV_ROOTDIR . '/' . $path, $upload_info['basename'], $thumb_config['thumb_quality']); } } } } } } $editor = $nv_Request->get_title('editor', 'post,get', ''); $CKEditorFuncNum = $nv_Request->get_int('CKEditorFuncNum', 'post,get', 0); if (!preg_match("/^([a-zA-Z0-9\\-\\_]+)\$/", $editor)) { $editor = ''; } if (empty($error)) { if (isset($array_dirname[$path])) { $did = $array_dirname[$path];
if (isset($array_thumb_config[$path])) { $thumb_config = $array_thumb_config[$path]; } else { $thumb_config = $array_thumb_config['']; $_arr_path = explode('/', $path); while (sizeof($_arr_path) > 1) { array_pop($_arr_path); $_path = implode('/', $_arr_path); if (isset($array_thumb_config[$_path])) { $thumb_config = $array_thumb_config[$_path]; break; } } } $createImage = new NukeViet\Files\Image(NV_ROOTDIR . '/' . $path . '/' . $file, NV_MAX_WIDTH, NV_MAX_HEIGHT); $createImage->addlogo($upload_logo, '', '', $config_logo); $createImage->save(NV_ROOTDIR . '/' . $path, $file, $thumb_config['thumb_quality']); $createImage->close(); if (isset($array_dirname[$path])) { if (preg_match('/^' . nv_preg_quote(NV_UPLOADS_DIR) . '\\/(([a-z0-9\\-\\_\\/]+\\/)*([a-z0-9\\-\\_\\.]+)(\\.(gif|jpg|jpeg|png|bmp)))$/i', $path . '/' . $file, $m)) { @nv_deletefile(NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $m[1]); } $info = nv_getFileInfo($path, $file); $did = $array_dirname[$path]; $db->query("UPDATE " . NV_UPLOAD_GLOBALTABLE . "_file SET filesize=" . $info['filesize'] . ", src='" . $info['src'] . "', srcwidth=" . $info['srcwidth'] . ", srcheight=" . $info['srcheight'] . ", sizes='" . $info['size'] . "', userid=" . $admin_info['userid'] . ", mtime=" . $info['mtime'] . " WHERE did = " . $did . " AND title = '" . $file . "'"); } die('OK#' . basename($file)); } else { die('ERROR#' . $lang_module['notlevel']); } }