本文整理汇总了PHP中image::rotate方法的典型用法代码示例。如果您正苦于以下问题:PHP image::rotate方法的具体用法?PHP image::rotate怎么用?PHP image::rotate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::rotate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: htmlspecialchars
}
$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: array
$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);