示例#1
0
}
$file = htmlspecialchars(trim($nv_Request->get_string('file', 'post,get')), ENT_QUOTES);
$file = basename($file);
if (empty($file) or !is_file(NV_ROOTDIR . '/' . $path . '/' . $file)) {
    die('ERROR#' . $lang_module['errorNotSelectFile'] . NV_ROOTDIR . '/' . $path . '/' . $file);
}
if ($nv_Request->isset_request('path', 'post') and $nv_Request->isset_request('direction', 'post')) {
    $direction = $nv_Request->get_int('direction', 'post', 0);
    if ($direction < 0) {
        $direction = 0;
    } elseif ($direction > 359) {
        $direction = 359;
    }
    if ($direction > 0 and $direction != 360) {
        require_once NV_ROOTDIR . '/includes/class/image.class.php';
        $createImage = new image(NV_ROOTDIR . '/' . $path . '/' . $file, NV_MAX_WIDTH, NV_MAX_HEIGHT);
        $createImage->rotate($direction);
        $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');
}
die('ERROR#Error Access!!!');
示例#2
0
$image->mark($waterMark, array('x' => 500, 'y' => 500))->save($file);
$images[] = $file;
logSection(file_exists($file), 'is created file exists', 'mark');
$data = $image->getPathInfo('/тестовый/путь/к.jpg');
logSection(is_array($data), 'is array result', 'pathinfo');
foreach ($data as $k => &$part) {
    logSection($part, '"' . $k . '"', 'pathinfo');
}
@mkdir($fixtures . '/mcr', 0777);
$thumbs = $image->createThumbs($fixtures . '/FordMustang.jpg', array('mcr/' => array('width' => 50, 'height' => 50, 'type' => 'width', 'crop' => 'left-top'), 'thumb_' => array('width' => 100, 'height' => 100, 'type' => 'height', 'crop' => 'left-top')));
$images = array_merge($thumbs, $images);
foreach ($thumbs as $tmb) {
    logSection(file_exists($tmb), 'is file exists', 'thumbs');
}
try {
    $file = $fixtures . '/FordMustang.rotate90.jpg';
    $oldWidth = $image->getData('width');
    $oldHeight = $image->getData('height');
    $image->rotate(90)->save($file);
    logSection($oldWidth == $image->getData('height') && $oldHeight == $image->getData('width'), 'is rotated', 'rotate');
    $images[] = $file;
} catch (Exception $e) {
    logSection(false, $e->getMessage(), 'error');
}
$file = $fixtures . '/FordMustang.polygonMask.jpg';
$w = $image->getData('width');
$h = $image->getData('height');
$image->mask('polygon', array(0, 100, 100, 0, $w - 100, 0, $w, 100, $w, $h - 100, $w - 100, $h, 100, $h, 0, $h - 100), 100, array(0, 255, 0))->save($file);
$images[] = $image->getSavedName();
logSection(file_exists($file), 'image was masked with #0f0 color');
removeCreated($images);