コード例 #1
0
ファイル: addlogo.php プロジェクト: lzhao18/nukeviet
    } elseif (file_exists(NV_ROOTDIR . '/' . $global_config['site_logo'])) {
        $upload_logo = NV_ROOTDIR . '/' . $global_config['site_logo'];
    } elseif (file_exists(NV_ROOTDIR . '/images/logo.png')) {
        $upload_logo = NV_ROOTDIR . '/images/logo.png';
    } else {
        die('ERROR#' . $lang_module['notlogo']);
    }
    $config_logo = array();
    $config_logo['x'] = $nv_Request->get_int('x', 'post', 0);
    $config_logo['y'] = $nv_Request->get_int('y', 'post', 0);
    $config_logo['w'] = $nv_Request->get_int('w', 'post', 0);
    $config_logo['h'] = $nv_Request->get_int('h', 'post', 0);
    if ($config_logo['w'] > 0 and $config_logo['h'] > 0) {
        require_once NV_ROOTDIR . '/includes/class/image.class.php';
        $createImage = new image(NV_ROOTDIR . '/' . $path . '/' . $file, NV_MAX_WIDTH, NV_MAX_HEIGHT);
        $createImage->addlogo($upload_logo, '', '', $config_logo);
        $createImage->save(NV_ROOTDIR . '/' . $path, $file);
        $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)))$/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']);
    }
}
コード例 #2
0
ファイル: main.php プロジェクト: hpleduit/module_photos
         if (ceil($photo['width'] * $photo_config['autologosize3'] / 100) > $logo_size[0]) {
             $w = $logo_size[0];
         } else {
             $w = ceil($photo['width'] * $photo_config['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 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_name . '/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;