对于织梦CMS自定义后台图片的显示顺序感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍织梦图片集如何调用,并为您提供关于为织梦CMS自定义表单添加提交时间、关于DEDECMS自定义模型当中添加自
对于织梦CMS自定义后台图片的显示顺序感兴趣的读者,本文将会是一篇不错的选择,我们将详细介绍织梦图片集如何调用,并为您提供关于为织梦CMS自定义表单添加提交时间、关于DEDECMS自定义模型当中添加自定义字段后在后台添加内容后不显示解决方案、帝国CMS7.5版支持自定义后台登录文件、摘自织梦CMS中的图片处理类,摘自织梦cms图片的有用信息。
本文目录一览:- 织梦CMS自定义后台图片的显示顺序(织梦图片集如何调用)
- 为织梦CMS自定义表单添加提交时间
- 关于DEDECMS自定义模型当中添加自定义字段后在后台添加内容后不显示解决方案
- 帝国CMS7.5版支持自定义后台登录文件
- 摘自织梦CMS中的图片处理类,摘自织梦cms图片
织梦CMS自定义后台图片的显示顺序(织梦图片集如何调用)
织梦CMS自定义后台图片的显示顺序
很多做图片站的网站管理员希望在上传图片时,能够按照自已定义的顺序进行显示,这就关联到程序改动了,修改办法如下:
打开后台dede/album_add.php (友情提示:dede是默认后台目录,请根据自己的网站修改)
找到:
$z = new zip();
$z->ExtractAll($zipfile,$tmpzipdir);
$fm = new FileManagement();
$imgs = array();
$fm->GetMatchFiles($tmpzipdir,"jpg|png|gif",$imgs);
后面添加如下代码:
//调整解压缩出来的数组
//mod by king
$tmpimgs = array();
foreach($imgs as $k=>$v){
preg_match_all("/\/(\d+)\./",$v,$kk);
$tmpimgs[$kk[1][0]-1] = $v;
}
ksort($tmpimgs);
$imgs = $tmpimgs;
unset($tmpimgs);
//
同理打开album_edit.php这个文件,在相同的代码后面添加上面的代码。
这样就可以解决图片顺序的问题了,图片命名格式为1.jpg,2.jpg,3.jpg,4.jpg等等.这样子生成的图片集文件就是按照这个顺序显示图片的。
为织梦CMS自定义表单添加提交时间
有不少用户都需要在织梦CMS留言上面增加一个关于用户提交留言的时间,好区分用户什么时候提交的留言。现织梦模58技术给大家分享一个简单的增加留言时间。首先自定义表单,然后添加字段,
比如联系人(单行文本),联系方式(单行文本),地址(单行文本),留言内容(单行文本),留言时间(单行文本)等字段
注意:留言时间这里不要选择“时间类型”,选择默认的“文本形式”就可以。
自定义表单在源码中修改如下:
<form action="/plus/diy.php" enctype="multipart/form-data" method="post" name="form" onsubmit="return CheckForm();">
<input type="hidden" name="action" value="post" />
<input type="hidden" name="diyid" value="1" />
<input type="hidden" name="do" value="2" />
提交时间
<input name="mytime" value="" type="text" id="mytime" /><!-- 如不需要在前台显示的话可以修改type="hidden" -->
<script type="text/javascript">
window.onload = function(){
var nowDate = new Date();
var str = nowDate.getFullYear()+"-"+(nowDate.getMonth() + 1)+"-"+nowDate.getDate()+" "+nowDate.getHours()+":"+nowDate.getMinutes()+":"+nowDate.getSeconds();
document.getElementById("mytime").value=str;
}
</script>
<input type="hidden" name="dede_fields" value="mytime,textchar" />
<input type="hidden" name="dede_fieldshash" value="849a871768b5942ee259e8f7af736194" />
<label><inputtype="submit" name="Submit" value=" 提交" /></label>
</form>
注明:当然这上面的代码是可以调用的。像这边测试的一个就像这样子。
这个是为显示的时间,如果自己不想他显示的
<input name="mytime" value="" type="text" id="mytime" /><!-- 如不需要在前台显示的话可以修改type="hidden" -->
好了目前大工完成。
关于DEDECMS自定义模型当中添加自定义字段后在后台添加内容后不显示解决方案
帝国CMS7.5版支持自定义后台登录文件
帝国cms7.5版在原来版本支持自定义后台目录基础上(可随时任意重命名admin目录,无需任何设置),还新增了支持自定义后台登录文件,双重自定义,安全性更高。
帝国cms7.5及以上版本,只需按下面操作就可以修改后台登录文件地址:
1、将 /e/admin/index.PHP 文件重命名。
2、将 /e/admin/ecmsadmin.PHP 文件重命名。
3、修改第1步重命名后的“/e/admin/index.PHP”文件内容,将:action="ecmsadmin.PHP" 修改为:action="第2步重命名后的文件名"
(注意事项:UTF8文件不能用记事本修改文件,否则会将文件转为GBK编码,推荐用Dreamweaver修改。)
4、至此,后台登录文件地址修改完成,以后登录后台必须访问第1步重命名后的文件名才可以登录后台。
其它说明
1、修改文件地址后,建议admin目录下再建空白的index.PHP和ecmsadmin.PHP文件,可以达到迷惑作用(比如:防火墙等防御就是显示空白,容易混淆原因)。
2、修改文件地址后,也可以建假的index.PHP和ecmsadmin.PHP文件,让不管信息对不对都登录不上,此方法适合懂PHP代码的人实施,但一般建空白文件就够了。
摘自织梦CMS中的图片处理类,摘自织梦cms图片
摘自织梦cms中的图片处理类,摘自织梦cms图片
本文实例讲述了摘自织梦cms中的图片处理类。分享给大家供大家参考。具体如下:
<?php if(!defined(''DEDEINC'')) exit(''dedecms''); /** * 图像处理类 * * @version $Id: image.class.php 1 18:10 2010年7月5日Z tianya $ * @package DedeCMS.Libraries * @copyright Copyright (c) 2007 - 2010, DesDev, Inc. * @license http://help.dedecms.com/usersguide/license.html * @link http://www.dedecms.com */ class image { var $attachinfo; var $targetfile; //图片路径 var $imagecreatefromfunc; var $imagefunc; var $attach; var $animatedgif; var $watermarkquality; var $watermarktext; var $thumbstatus; var $watermarkstatus; // 析构函数,兼容PHP4 function image($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans,$trueMarkimg, $attach = array()) { $this->__construct($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans,$trueMarkimg, $attach); } // 析构函数 function __construct($targetfile, $cfg_thumb, $cfg_watermarktext, $photo_waterpos, $photo_diaphaneity, $photo_wheight, $photo_wwidth, $cfg_watermarktype, $photo_marktrans,$trueMarkimg, $attach = array()) { $this->thumbstatus = $cfg_thumb; $this->watermarktext = $cfg_watermarktext; $this->watermarkstatus = $photo_waterpos; $this->watermarkquality = $photo_marktrans; $this->watermarkminwidth = $photo_wwidth; $this->watermarkminheight = $photo_wheight; $this->watermarktype = $cfg_watermarktype; $this->watermarktrans = $photo_diaphaneity; $this->animatedgif = 0; $this->targetfile = $targetfile; $this->attachinfo = @getimagesize($targetfile); $this->attach = $attach; switch($this->attachinfo[''mime'']) { case ''image/jpeg'': $this->imagecreatefromfunc = function_exists(''imagecreatefromjpeg'') ? ''imagecreatefromjpeg'' : ''''; $this->imagefunc = function_exists(''imagejpeg'') ? ''imagejpeg'' : ''''; break; case ''image/gif'': $this->imagecreatefromfunc = function_exists(''imagecreatefromgif'') ? ''imagecreatefromgif'' : ''''; $this->imagefunc = function_exists(''imagegif'') ? ''imagegif'' : ''''; break; case ''image/png'': $this->imagecreatefromfunc = function_exists(''imagecreatefrompng'') ? ''imagecreatefrompng'' : ''''; $this->imagefunc = function_exists(''imagepng'') ? ''imagepng'' : ''''; break; }//为空则匹配类型的函数不存在 $this->attach[''size''] = empty($this->attach[''size'']) ? @filesize($targetfile) : $this->attach[''size'']; if($this->attachinfo[''mime''] == ''image/gif'') { $fp = fopen($targetfile, ''rb''); $targetfilecontent = fread($fp, $this->attach[''size'']); fclose($fp); $this->animatedgif = strpos($targetfilecontent, ''NETSCAPE2.0'') === false ? 0 : 1; } } /** * 生成缩略图 * * @access public * @param int $thumbwidth 图片宽度 * @param int $thumbheight 图片高度 * @param int $preview 是否预览 * @return void */ function thumb($thumbwidth, $thumbheight, $preview = 0) { $this->thumb_gd($thumbwidth, $thumbheight, $preview); if($this->thumbstatus == 2 && $this->watermarkstatus) { $this->image($this->targetfile, $this->attach); $this->attach[''size''] = filesize($this->targetfile); } } /** * 图片水印 * * @access public * @param int $preview 是否预览 * @return void */ function watermark($preview = 0) { if($this->watermarkminwidth && $this->attachinfo[0] <= $this->watermarkminwidth && $this->watermarkminheight && $this->attachinfo[1] <= $this->watermarkminheight) { return ; } $this->watermark_gd($preview); } /** * 使用gd生成缩略图 * * @access public * @param int $thumbwidth 图片宽度 * @param int $thumbheight 图片高度 * @param int $preview 是否预览 * @return void */ function thumb_gd($thumbwidth, $thumbheight, $preview = 0) { if($this->thumbstatus && function_exists(''imagecreatetruecolor'') && function_exists(''imagecopyresampled'') && function_exists(''imagejpeg'')) { $imagecreatefromfunc = $this->imagecreatefromfunc; $imagefunc = $this->thumbstatus == 1 ? ''imagejpeg'' : $this->imagefunc; list($imagewidth, $imageheight) = $this->attachinfo; if(!$this->animatedgif && ($imagewidth >= $thumbwidth || $imageheight >= $thumbheight)) { $attach_photo = $imagecreatefromfunc($this->targetfile); $x_ratio = $thumbwidth / $imagewidth; $y_ratio = $thumbheight / $imageheight; if(($x_ratio * $imageheight) < $thumbheight) { $thumb[''height''] = ceil($x_ratio * $imageheight); $thumb[''width''] = $thumbwidth; } else { $thumb[''width''] = ceil($y_ratio * $imagewidth); $thumb[''height''] = $thumbheight; } $targetfile = !$preview ? ($this->thumbstatus == 1 ? $this->targetfile.''.thumb.jpg'' : $this->targetfile) : ''./watermark_tmp.jpg''; $thumb_photo = imagecreatetruecolor($thumb[''width''], $thumb[''height'']); imagecopyresampled($thumb_photo, $attach_photo, 0, 0, 0, 0, $thumb[''width''], $thumb[''height''], $imagewidth, $imageheight); if($this->attachinfo[''mime''] == ''image/jpeg'') { $imagefunc($thumb_photo, $targetfile, 100); } else { $imagefunc($thumb_photo, $targetfile); } $this->attach[''thumb''] = $this->thumbstatus == 1 ? 1 : 0; } } } /** * 使用gd进行水印 * * @access public * @param int $preview 是否预览 * @return void */ function watermark_gd($preview = 0) { if($this->watermarkstatus && function_exists(''imagecopy'') && function_exists(''imagealphablending'') && function_exists(''imagecopymerge'')) { $imagecreatefunc = $this->imagecreatefromfunc; $imagefunc = $this->imagefunc; list($imagewidth, $imageheight) = $this->attachinfo; if($this->watermarktype < 2) { $watermark_file = $this->watermarktype == 1 ? DEDEDATA.''/mark/mark.png'' : DEDEDATA.''/mark/mark.gif''; $watermarkinfo = @getimagesize($watermark_file); $watermark_logo = $this->watermarktype == 1 ? @imagecreatefrompng($watermark_file) : @imagecreatefromgif($watermark_file); if(!$watermark_logo) { return ; } list($logowidth, $logoheight) = $watermarkinfo; } else { $box = @imagettfbbox($this->watermarktext[''size''], $this->watermarktext[''angle''], $this->watermarktext[''fontpath''],$this->watermarktext[''text'']); $logowidth = max($box[2], $box[4]) - min($box[0], $box[6]); $logoheight = max($box[1], $box[3]) - min($box[5], $box[7]); $ax = min($box[0], $box[6]) * -1; $ay = min($box[5], $box[7]) * -1; } $wmwidth = $imagewidth - $logowidth; $wmheight = $imageheight - $logoheight; if(($this->watermarktype < 2 && is_readable($watermark_file) || $this->watermarktype == 2) && $wmwidth > 10 && $wmheight > 10 && !$this->animatedgif) { switch($this->watermarkstatus) { case 1: $x = +5; $y = +5; break; case 2: $x = ($imagewidth - $logowidth) / 2; $y = +5; break; case 3: $x = $imagewidth - $logowidth - 5; $y = +5; break; case 4: $x = +5; $y = ($imageheight - $logoheight) / 2; break; case 5: $x = ($imagewidth - $logowidth) / 2; $y = ($imageheight - $logoheight) / 2; break; case 6: $x = $imagewidth - $logowidth - 5; $y = ($imageheight - $logoheight) / 2; break; case 7: $x = +5; $y = $imageheight - $logoheight - 5; break; case 8: $x = ($imagewidth - $logowidth) / 2; $y = $imageheight - $logoheight - 5; break; case 9: $x = $imagewidth - $logowidth - 5; $y = $imageheight - $logoheight -5; break; } $dst_photo = @imagecreatetruecolor($imagewidth, $imageheight); $target_photo = $imagecreatefunc($this->targetfile); imagecopy($dst_photo, $target_photo, 0, 0, 0, 0, $imagewidth, $imageheight); if($this->watermarktype == 1) { imagecopy($dst_photo, $watermark_logo, $x, $y, 0, 0, $logowidth, $logoheight); } elseif($this->watermarktype == 2) { if(($this->watermarktext[''shadowx''] || $this->watermarktext[''shadowy'']) && $this->watermarktext[''shadowcolor'']) { $shadowcolorrgb = explode('','', $this->watermarktext[''shadowcolor'']); $shadowcolor = imagecolorallocate($dst_photo, $shadowcolorrgb[0], $shadowcolorrgb[1], $shadowcolorrgb[2]); imagettftext($dst_photo, $this->watermarktext[''size''], $this->watermarktext[''angle''], $x + $ax + $this->watermarktext[''shadowx''], $y + $ay + $this->watermarktext[''shadowy''], $shadowcolor, $this->watermarktext[''fontpath''], $this->watermarktext[''text'']); } $colorrgb = explode('','', $this->watermarktext[''color'']); $color = imagecolorallocate($dst_photo, $colorrgb[0], $colorrgb[1], $colorrgb[2]); imagettftext($dst_photo, $this->watermarktext[''size''], $this->watermarktext[''angle''], $x + $ax, $y + $ay, $color, $this->watermarktext[''fontpath''], $this->watermarktext[''text'']); } else { imagealphablending($watermark_logo, true); imagecopymerge($dst_photo, $watermark_logo, $x, $y, 0, 0, $logowidth, $logoheight, $this->watermarktrans); } $targetfile = !$preview ? $this->targetfile : ''./watermark_tmp.jpg''; if($this->attachinfo[''mime''] == ''image/jpeg'') { $imagefunc($dst_photo, $targetfile, $this->watermarkquality); } else { $imagefunc($dst_photo, $targetfile); } $this->attach[''size''] = filesize($this->targetfile); } } } }//End Class
希望本文所述对大家的php程序设计有所帮助。
关于织梦CMS自定义后台图片的显示顺序和织梦图片集如何调用的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于为织梦CMS自定义表单添加提交时间、关于DEDECMS自定义模型当中添加自定义字段后在后台添加内容后不显示解决方案、帝国CMS7.5版支持自定义后台登录文件、摘自织梦CMS中的图片处理类,摘自织梦cms图片等相关内容,可以在本站寻找。
本文标签: