本文整理汇总了PHP中nv_is_image函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_is_image函数的具体用法?PHP nv_is_image怎么用?PHP nv_is_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_is_image函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: nv_resize_crop_image
function nv_resize_crop_image($img_path, $width, $height, $module_name = '', $id = 0)
{
$new_img_path = '';
if (file_exists($img_path)) {
$imginfo = nv_is_image($img_path);
$basename = basename($img_path);
if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $id . '_\\1_' . $width . '-' . $height . '\\2', $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$new_img_path = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
} else {
$img_path = new image($img_path, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$thumb_width = $width;
$thumb_height = $height;
$maxwh = max($thumb_width, $thumb_height);
if ($img_path->fileinfo['width'] > $img_path->fileinfo['height']) {
$width = 0;
$height = $maxwh;
} else {
$width = $maxwh;
$height = 0;
}
$img_path->resizeXY($width, $height);
$img_path->cropFromCenter($thumb_width, $thumb_height);
$img_path->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$new_img_path = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
}
}
}
}
return $new_img_path;
}
示例2: nv_news_block_newscenter
function nv_news_block_newscenter($block_config)
{
global $module_data, $module_name, $module_file, $global_array_cat, $global_config, $lang_module, $db, $module_config, $module_info;
$module_name = 'news';
$module_data = 'news';
$xtpl = new XTemplate('block_newscenter.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks');
$xtpl->assign('lang', $lang_module);
$xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
$db->sqlreset()->select('id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status= 1')->order('publtime DESC')->limit(5);
$list = nv_db_cache($db->sql(), 'id', $module_name);
$i = 1;
foreach ($list as $row) {
$row['publtime'] = nv_date('m/d/Y', $row['publtime']);
$row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_cat[$row['catid']]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
$row['title0'] = nv_clean60(strip_tags($row['title']), $i == 1 ? 50 : 30);
$row['hometext'] = nv_clean60(strip_tags($row['hometext']), 260);
$image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $row['homeimgfile'];
if ($row['homeimgfile'] != '' and file_exists($image)) {
if ($i == 1) {
$width = 570;
$height = 490;
} else {
$width = 270;
$height = 230;
}
$row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $row['homeimgfile'];
$imginfo = nv_is_image($image);
$basename = basename($image);
if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
} else {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$_image->cropFromCenter($width, $height);
$_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
}
}
}
} elseif (nv_is_url($row['homeimgfile'])) {
$row['imgsource'] = $row['homeimgfile'];
} elseif (!empty($module_config[$module_name]['show_no_image'])) {
$row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
} else {
$row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no-image.png';
}
$xtpl->assign('main' . $i, $row);
++$i;
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例3: creat_thumbs
function creat_thumbs($id, $homeimgfile, $module_name, $width = 200, $height = 150)
{
if ($width >= $height) {
$rate = $width / $height;
} else {
$rate = $height / $width;
}
$image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $homeimgfile;
if ($homeimgfile != '' and file_exists($image)) {
$imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $homeimgfile;
$imginfo = nv_is_image($image);
$basename = $module_name . $width . 'x' . $height . '-' . $id . '-' . md5_file($image) . '.' . $imginfo['ext'];
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$imgsource = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
} else {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
if ($imginfo['width'] <= $imginfo['height']) {
$_image->resizeXY($width, 0);
} elseif ($imginfo['width'] / $imginfo['height'] < $rate) {
$_image->resizeXY($width, 0);
} elseif ($imginfo['width'] / $imginfo['height'] >= $rate) {
$_image->resizeXY(0, $height);
}
$_image->cropFromCenter($width, $height);
$_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$imgsource = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
}
}
} elseif (nv_is_url($homeimgfile)) {
$imgsource = $homeimgfile;
} else {
$imgsource = '';
}
return $imgsource;
}
示例4: photos_thumbs
function photos_thumbs($id, $file, $module_upload, $width = 270, $height = 210, $quality = 90)
{
if ($width >= $height) {
$rate = $width / $height;
} else {
$rate = $height / $width;
}
$image = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/images/' . $file;
if ($file != '' and file_exists($image)) {
$imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/images/' . $file;
$imginfo = nv_is_image($image);
$basename = $module_upload . '_' . $width . 'x' . $height . '-' . $id . '-' . md5_file($image) . '.' . $imginfo['ext'];
if (file_exists(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/' . $basename)) {
$imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/' . $basename;
} else {
$_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
if ($imginfo['width'] <= $imginfo['height']) {
$_image->resizeXY($width, 0);
} elseif ($imginfo['width'] / $imginfo['height'] < $rate) {
$_image->resizeXY($width, 0);
} elseif ($imginfo['width'] / $imginfo['height'] >= $rate) {
$_image->resizeXY(0, $height);
}
$_image->cropFromCenter($width, $height);
$_image->save(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/', $basename, $quality);
if (file_exists(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/' . $basename)) {
$imgsource = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/thumbs/' . $basename;
}
}
} elseif (nv_is_url($file)) {
$imgsource = $file;
} else {
$imgsource = '';
}
return $imgsource;
}
示例5: addlogo
/**
* image::addlogo()
*
* @param mixed $logo
* @param string $align
* @param string $valign
* @return
*/
function addlogo($logo, $align = 'right', $valign = 'bottom')
{
if (empty($this->error)) {
if ($this->is_destroy) {
$this->get_createImage();
}
$logo_info = nv_is_image($logo);
if ($logo_info != array() and $logo_info['width'] != 0 and $logo_info['width'] + 20 <= $this->create_Image_info['width'] and $logo_info['height'] != 0 and $logo_info['height'] + 20 <= $this->create_Image_info['height'] and preg_match("#imagetype\\_(gif|jpeg|png)\$#is", $logo_info['type']) and preg_match("#image\\/[x\\-]*(jpg|pjpeg|gif|png)#is", $logo_info['mime'])) {
$this->set_memory_limit();
switch ($logo_info['type']) {
case 'IMAGETYPE_GIF':
$this->logoimg = ImageCreateFromGif($logo);
break;
case 'IMAGETYPE_JPEG':
$this->logoimg = ImageCreateFromJpeg($logo);
break;
case 'IMAGETYPE_PNG':
$this->logoimg = ImageCreateFromPng($logo);
break;
}
switch ($align) {
case 'left':
$X = 10;
break;
case 'center':
$X = ceil(($this->create_Image_info['width'] - $logo_info['width']) / 2);
break;
default:
$X = $this->create_Image_info['width'] - ($logo_info['width'] + 10);
}
switch ($valign) {
case 'top':
$Y = 10;
break;
case 'middle':
$Y = ceil(($this->create_Image_info['height'] - $logo_info['height']) / 2);
break;
default:
$Y = $this->create_Image_info['height'] - ($logo_info['height'] + 10);
}
ImageCopyResampled($this->createImage, $this->logoimg, $X, $Y, 0, 0, $logo_info['width'], $logo_info['height'], $logo_info['width'], $logo_info['height']);
}
}
}
示例6: nv_news_block_news
function nv_news_block_news($block_config, $mod_data)
{
global $module_array_cat, $module_info, $db, $module_config, $global_config;
$module = 'news';
$blockwidth = $module_config[$module]['blockwidth'];
$show_no_image = $module_config[$module]['show_no_image'];
$numrow = isset($block_config['numrow']) ? $block_config['numrow'] : 20;
$cache_file = NV_LANG_DATA . '__block_news_' . $numrow . '_' . NV_CACHE_PREFIX . '.cache';
if (($cache = nv_get_cache($module, $cache_file)) != false) {
$array_block_news = unserialize($cache);
} else {
$array_block_news = array();
$db->sqlreset()->select('id, catid, publtime, exptime, title, alias, homeimgthumb, homeimgfile, hometext')->from(NV_PREFIXLANG . '_' . $mod_data . '_rows')->where('status= 1')->order('publtime DESC')->limit($numrow);
$result = $db->query($db->sql());
while (list($id, $catid, $publtime, $exptime, $title, $alias, $homeimgthumb, $homeimgfile, $hometext) = $result->fetch(3)) {
$link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_array_cat[$catid]['alias'] . '/' . $alias . '-' . $id . $global_config['rewrite_exturl'];
$array_block_news[] = array('id' => $id, 'title' => $title, 'link' => $link, 'homeimgfile' => $homeimgfile, 'width' => $blockwidth, 'hometext' => $hometext);
}
$cache = serialize($array_block_news);
nv_set_cache($module, $cache_file, $cache);
}
if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/blocks/block_news.tpl')) {
$block_theme = $module_info['template'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate('block_news.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/blocks/');
$i = 1;
foreach ($array_block_news as $array_news) {
$array_news['hometext'] = nv_clean60($array_news['hometext'], 20);
$image = NV_UPLOADS_REAL_DIR . '/' . $module . '/' . $array_news['homeimgfile'];
if ($array_news['homeimgfile'] != '' and file_exists($image)) {
if ($i == 1) {
$width = 370;
$height = 150;
} else {
$width = 170;
$height = 115;
}
$array_news['imgurl'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_news['homeimgfile'];
$imginfo = nv_is_image($image);
$basename = basename($image);
if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$array_news['imgurl'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
} else {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$_image->cropFromCenter($width, $height);
$_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$array_news['imgurl'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
}
}
}
} elseif (nv_is_url($array_news['homeimgfile'])) {
$array_news['imgurl'] = $array_news['homeimgfile'];
} elseif (!empty($module_config[$module_name]['show_no_image'])) {
$array_news['imgurl'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
} else {
$array_news['imgurl'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no-image.png';
}
$xtpl->assign('blocknews', $array_news);
if ($i == 1) {
$xtpl->parse('main.news_main');
} else {
$array_news['title0'] = nv_clean60($array_news['title'], 40);
$xtpl->assign('blocknews', $array_news);
$xtpl->assign('FL', $i % 2 != 0 ? 'right' : 'left');
$xtpl->parse('main.newsloop');
}
$i++;
}
$xtpl->parse('main');
return $xtpl->text('main');
}
示例7: nv_display_othersimage
/**
* nv_display_othersimage
*
* @param mixed $otherimage
* @return
*/
function nv_display_othersimage($otherimage)
{
global $module_info, $lang_module, $lang_global, $module_name, $module_data, $module_file, $module_upload, $pro_config, $op, $my_head;
$xtpl = new XTemplate('othersimg.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
if (!empty($otherimage)) {
$otherimage = explode('|', $otherimage);
foreach ($otherimage as $otherimage_i) {
if (!empty($otherimage_i) and file_exists(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $otherimage_i)) {
$otherimage_i = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $otherimage_i;
$xtpl->assign('IMG_SRC_OTHER', $otherimage_i);
if (!empty($otherimage_i) and file_exists(NV_ROOTDIR . $otherimage_i)) {
$xtpl->assign('IMG_SRC_OTHER_INFO', nv_is_image(NV_ROOTDIR . $otherimage_i));
}
$xtpl->parse('main.othersimg.loop');
}
}
$xtpl->parse('main.othersimg');
$xtpl->parse('main');
return $xtpl->text('main');
}
}
示例8: nv_news_block_newscenter
function nv_news_block_newscenter($block_config)
{
global $module_data, $module_name, $module_file, $module_upload, $global_array_cat, $global_config, $lang_module, $db, $module_config, $module_info;
$db->sqlreset()->select('id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->order('publtime DESC')->limit($block_config['numrow']);
if (empty($block_config['nocatid'])) {
$db->where('status= 1');
} else {
$db->where('status= 1 AND catid NOT IN (' . implode(',', $block_config['nocatid']) . ')');
}
$list = $nv_Cache->db($db->sql(), 'id', $module_name);
if (!empty($list)) {
$xtpl = new XTemplate('block_newscenter.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$xtpl->assign('lang', $lang_module);
$xtpl->assign('TOOLTIP_POSITION', $block_config['tooltip_position']);
$_first = true;
foreach ($list as $row) {
$row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_cat[$row['catid']]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
$row['titleclean60'] = nv_clean60($row['title'], $block_config['length_title']);
if ($_first) {
$_first = false;
$width = isset($block_config['width']) ? $block_config['width'] : 400;
$height = isset($block_config['height']) ? $block_config['height'] : 268;
if ($row['homeimgfile'] != '' and ($imginfo = nv_is_image(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $row['homeimgfile'])) != array()) {
$image = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
if ($imginfo['width'] <= $width and $imginfo['height'] <= $height) {
$row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
$row['width'] = $imginfo['width'];
} else {
$basename = preg_replace('/(.*)(\\.[a-z]+)$/i', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', basename($image));
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$imginfo = nv_is_image(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename);
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
$row['width'] = $imginfo['width'];
} else {
$_image = new NukeViet\Files\Image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$_image->resizeXY($width, $height);
$_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
$row['width'] = $_image->create_Image_info['width'];
}
}
}
} elseif (nv_is_url($row['homeimgfile'])) {
$row['imgsource'] = $row['homeimgfile'];
$row['width'] = $width;
} elseif (!empty($module_config[$module_name]['show_no_image'])) {
$row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
$row['width'] = $width;
} else {
$row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no_image.gif';
$row['width'] = $width;
}
$row['hometext'] = nv_clean60(strip_tags($row['hometext']), $block_config['length_hometext']);
$xtpl->assign('main', $row);
} else {
if ($row['homeimgthumb'] == 1) {
$row['imgsource'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
} elseif ($row['homeimgthumb'] == 2) {
$row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
} elseif ($row['homeimgthumb'] == 3) {
$row['imgsource'] = $row['homeimgfile'];
} elseif (!empty($module_config[$module_name]['show_no_image'])) {
$row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
} else {
$row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no_image.gif';
}
$row['hometext'] = nv_clean60(strip_tags($row['hometext']), $block_config['tooltip_length']);
$xtpl->assign('othernews', $row);
if (!$block_config['showtooltip']) {
$xtpl->assign('TITLE', 'title="' . $row['title'] . '"');
}
if ($block_config['showtooltip']) {
$xtpl->parse('main.othernews.tooltip');
}
$xtpl->parse('main.othernews');
}
}
$xtpl->parse('main');
return $xtpl->text('main');
}
}
示例9: foreach
$stmt->bindParam(':allow_comment', $data['allow_comment'], PDO::PARAM_STR);
if ($stmt->execute()) {
try {
$count = 0;
foreach ($data['albums'] as $key => $photo) {
$photo['row_id'] = isset($photo['row_id']) ? $photo['row_id'] : 0;
$photo['name'] = isset($photo['name']) ? $photo['name'] : '';
$photo['filePath'] = isset($photo['filePath']) ? $photo['filePath'] : $photo['filePath'];
$photo['image_url'] = isset($photo['image_url']) ? $photo['image_url'] : $photo['image_url'];
$photo['thumb'] = isset($photo['thumb']) ? $photo['thumb'] : $photo['thumb'];
$photo['description'] = isset($photo['description']) ? $photo['description'] : '';
$photo['description'] = nv_nl2br(nv_htmlspecialchars(strip_tags($photo['description'])), '<br />');
$photo['defaults'] = isset($photo['defaults']) ? $photo['defaults'] : 0;
if ($photo['row_id'] == 0) {
// Kiem tra anh hop le
$image_info = nv_is_image(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $photo['basename']);
if (empty($image_info) or !isset($mime['images'][$image_info['ext']])) {
$error['error_image'][] = $lang_module['album_error_mime'] . ' ' . $photo['basename'];
@nv_deletefile(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $photo['basename']);
unset($data['albums'][$key]);
} else {
$photo['width'] = $image_info['width'];
$photo['height'] = $image_info['height'];
$photo['mime'] = $image_info['mime'];
$photo['size'] = filesize($image_info['src']);
}
$folder_album = NV_ROOTDIR . '/' . $currentpath . '/' . $data['folder'];
if (is_dir($folder_album)) {
// Copy file anh goc
$basename = basename($photo['basename']);
$basename2 = $basename;
示例10: array
$array_data = array();
$base_url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
$db->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $module_data)->where('status=1');
$all_page = $db->query($db->sql())->fetchColumn();
$db->select('*')->order('id DESC')->limit($per_page)->offset(($page - 1) * $per_page);
$_query = $db->query($db->sql());
while ($row = $_query->fetch()) {
if (!nv_user_in_groups($global_array_event_cat[$row['catid']]['groups_view']) or !nv_user_in_groups($row['groups_view'])) {
continue;
}
$image = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
if ($row['homeimgfile'] != '' and file_exists($image)) {
$width = 175;
$height = 150;
$row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
$imginfo = nv_is_image($image);
$basename = basename($image);
if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
} else {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$thumb_width = $width;
$thumb_height = $height;
$maxwh = max($thumb_width, $thumb_height);
if ($image->fileinfo['width'] > $image->fileinfo['height']) {
$width = 0;
$height = $maxwh;
} else {
示例11: elseif
$catid_i = $listcatid;
}
// Xac dinh anh nho
if ($homeimgthumb == 1) {
$thumb = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $homeimgfile;
$imghome = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $homeimgfile;
} elseif ($homeimgthumb == 2) {
$imghome = $thumb = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $homeimgfile;
} elseif ($homeimgthumb == 3) {
$imghome = $thumb = $homeimgfile;
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $theme . '/images/' . $module_file . '/no-image.jpg')) {
$imghome = $thumb = NV_BASE_SITEURL . 'themes/' . $theme . '/images/' . $module_file . '/no-image.jpg';
} else {
$imghome = $thumb = NV_BASE_SITEURL . 'themes/default/images/' . $module_file . '/no-image.jpg';
}
$xtpl->assign('ROW', array('id' => $id, 'link' => NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_shops_cat[$catid_i]['alias'] . '/' . $alias . $global_config['rewrite_exturl'], 'link_seller' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=seller&pro_id=' . $id . '&nv_redirect=' . nv_redirect_encrypt($base_url), 'link_copy' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=content&copy&id=' . $id, 'link_warehouse' => NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=warehouse&listid=' . $id . '&checkss=' . md5($global_config['sitekey'] . session_id()), 'title' => $title, 'publtime' => $publtime, 'edittime' => $edittime, 'hitstotal' => $hitstotal, 'num_sell' => $num_sell, 'product_unit' => isset($array_unit[$product_unit]) ? $array_unit[$product_unit][NV_LANG_DATA . '_title'] : '', 'status' => $lang_module['status_' . $status], 'admin_id' => !empty($username) ? $username : '', 'product_number' => $product_number, 'product_price' => nv_number_format($product_price, nv_get_decimals($money_unit)), 'money_unit' => $money_unit, 'thumb' => $thumb, 'imghome' => $imghome, 'imghome_info' => nv_is_image(NV_ROOTDIR . '/' . $imghome), 'link_edit' => nv_link_edit_page($id), 'link_delete' => nv_link_delete_page($id)));
if ($num_sell > 0) {
$xtpl->parse('main.loop.seller');
} else {
$xtpl->parse('main.loop.seller_empty');
}
// Hien thi nhap kho
if ($pro_config['active_warehouse']) {
$xtpl->parse('main.loop.warehouse_icon');
}
$xtpl->parse('main.loop');
++$a;
}
$array_list_action = array('delete' => $lang_global['delete'], 'publtime' => $lang_module['publtime'], 'exptime' => $lang_module['exptime'], 'addtoblock' => $lang_module['addtoblock']);
if ($pro_config['active_warehouse']) {
$array_list_action['warehouse'] = $lang_module['warehouse'];
示例12: viewsubcat_main
function viewsubcat_main($viewcat, $array_cat)
{
global $module_name, $module_file, $global_array_cat, $lang_module, $module_config, $module_info, $global_config;
$xtpl = new XTemplate($viewcat . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('TEMPLATE', $global_config['module_theme']);
// Hien thi cac chu de con
foreach ($array_cat as $key => $array_row_i) {
if (isset($array_cat[$key]['content'])) {
$array_row_i['rss'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $module_info['alias']['rss'] . "/" . $array_row_i['alias'];
$xtpl->assign('CAT', $array_row_i);
$catid = intval($array_row_i['catid']);
if ($array_row_i['subcatid'] != '') {
$exl = 0;
$arrsubcat_s = explode(',', $array_row_i['subcatid']);
foreach ($arrsubcat_s as $subcatid_i) {
if ($global_array_cat[$subcatid_i]['inhome'] == 1) {
$xtpl->clear_autoreset();
if ($exl < 3) {
$xtpl->assign('SUBCAT', $global_array_cat[$subcatid_i]);
$xtpl->parse('main.listcat.subcatloop');
$xtpl->set_autoreset();
} else {
$more = array('title' => $lang_module['more'], 'link' => $global_array_cat[$catid]['link']);
$xtpl->assign('MORE', $more);
$xtpl->parse('main.listcat.subcatmore');
$xtpl->set_autoreset();
break;
}
++$exl;
}
}
}
$a = 0;
$xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
foreach ($array_cat[$key]['content'] as $array_row_i) {
$newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday'];
$array_row_i['publtime'] = nv_date('d/m/Y h:i:s A', $array_row_i['publtime']);
$array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], 90);
$array_row_i['title0'] = nv_clean60($array_row_i['title'], 40);
++$a;
if ($a == 1) {
$image = NV_UPLOADS_REAL_DIR . '/' . $module_name . '/' . $array_row_i['homeimgfile'];
if ($array_row_i['homeimgfile'] != '' and file_exists($image)) {
$width = 370;
$height = 200;
$array_row_i['imghome'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $array_row_i['homeimgfile'];
$imginfo = nv_is_image($image);
$basename = basename($image);
if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $array_row_i['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$array_row_i['imghome'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
} else {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$_image->cropFromCenter($width, $height);
$_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$array_row_i['imghome'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
}
}
}
}
if ($newday >= NV_CURRENTTIME) {
$xtpl->parse('main.listcat.newday');
}
$xtpl->assign('CONTENT', $array_row_i);
if ($array_row_i['imghome'] != "") {
$xtpl->assign('HOMEIMG', $array_row_i['imghome']);
$xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
$xtpl->parse('main.listcat.image');
}
if (defined('NV_IS_MODADMIN')) {
$xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id']));
$xtpl->parse('main.listcat.adminlink');
}
} else {
if ($newday >= NV_CURRENTTIME) {
$xtpl->assign('CLASS', 'icon_new_small');
} else {
$xtpl->assign('CLASS', 'icon_list');
}
$array_row_i['title0'] = nv_clean60($array_row_i['title'], 35);
$array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], 90);
$xtpl->assign('OTHER', $array_row_i);
$xtpl->parse('main.listcat.related.loop');
}
if ($a > 1) {
$xtpl->assign('WCT', 'col-md-8 ');
} else {
$xtpl->assign('WCT', '');
}
$xtpl->set_autoreset();
}
if ($a > 1) {
$xtpl->parse('main.listcat.related');
}
$xtpl->parse('main.listcat');
}
//.........这里部分代码省略.........
示例13: nv_news_block_newscenter
function nv_news_block_newscenter($block_config)
{
global $module_data, $module_name, $module_file, $module_upload, $global_array_cat, $global_config, $lang_module, $db, $module_config, $module_info;
$db->sqlreset()->select('id, catid, publtime, title, alias, hometext, homeimgthumb, homeimgfile')->from(NV_PREFIXLANG . '_' . $module_data . '_rows')->where('status= 1')->order('publtime DESC')->limit(4);
$list = nv_db_cache($db->sql(), 'id', $module_name);
if (!empty($list)) {
$xtpl = new XTemplate('block_newscenter.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
$xtpl->assign('lang', $lang_module);
$i = 1;
foreach ($list as $row) {
$row['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_cat[$row['catid']]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
$row['hometext'] = nv_clean60(strip_tags($row['hometext']), 360);
$row['titleclean60'] = nv_clean60($row['title'], 60);
if ($i == 1) {
$image = NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
if ($row['homeimgfile'] != '' and file_exists($image)) {
$width = isset($block_config['width']) ? $block_config['width'] : 183;
$height = isset($block_config['height']) ? $block_config['height'] : 150;
$row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
$imginfo = nv_is_image($image);
$basename = basename($image);
if ($imginfo['width'] > $width or $imginfo['height'] > $height) {
$basename = preg_replace('/(.*)(\\.[a-zA-Z]+)$/', $module_name . '_' . $row['id'] . '_\\1_' . $width . '-' . $height . '\\2', $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
} else {
require_once NV_ROOTDIR . '/includes/class/image.class.php';
$_image = new image($image, NV_MAX_WIDTH, NV_MAX_HEIGHT);
$_image->resizeXY($width, $height);
$_image->save(NV_ROOTDIR . '/' . NV_TEMP_DIR, $basename);
if (file_exists(NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' . $basename)) {
$row['imgsource'] = NV_BASE_SITEURL . NV_TEMP_DIR . '/' . $basename;
}
}
}
} elseif (nv_is_url($row['homeimgfile'])) {
$row['imgsource'] = $row['homeimgfile'];
} elseif (!empty($module_config[$module_name]['show_no_image'])) {
$row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
} else {
$row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no_image.gif';
}
$xtpl->assign('main', $row);
++$i;
} else {
if ($row['homeimgthumb'] == 1) {
$row['imgsource'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
} elseif ($row['homeimgthumb'] == 2) {
$row['imgsource'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $row['homeimgfile'];
} elseif ($row['homeimgthumb'] == 3) {
$row['imgsource'] = $row['homeimgfile'];
} elseif (!empty($module_config[$module_name]['show_no_image'])) {
$row['imgsource'] = NV_BASE_SITEURL . $module_config[$module_name]['show_no_image'];
} else {
$row['imgsource'] = NV_BASE_SITEURL . 'themes/' . $global_config['site_theme'] . '/images/no_image.gif';
}
$row['hometext'] = nv_clean60($row['hometext'], $block_config['tooltip_length'], true);
$xtpl->assign('othernews', $row);
if (!$block_config['showtooltip']) {
$xtpl->assign('TITLE', 'title="' . $row['title'] . '"');
}
$xtpl->parse('main.othernews');
}
}
if ($block_config['showtooltip']) {
$xtpl->assign('TOOLTIP_POSITION', $block_config['tooltip_position']);
$xtpl->parse('main.tooltip');
}
$xtpl->parse('main');
return $xtpl->text('main');
}
}