1Next >
无聊的飞翔 | 发表于:11-11-26 21:19 [添加收藏] 楼主 [回复] #Top# |
---|---|
![]() ![]() ![]() ![]() ![]() ![]() |
KingCMS5.0添加水印
page/system/fun.asp 问题 isobj(l1) 函数 l2.open server.mappath(king_system&"system/images/load.gif") '判断aspjpeg组件 if err.number=0 then isobj=true 取得错误码:err.number=2 不知是不是服务器组件是否有问题 我决定不用这个检测aspjpeg过程 查找watermark(l1)过程修改 public sub watermark(l1) on error resume next dim I1,I2,I3 Err.clear set I1=server.createobject(king_jpeg)'原始图 if king_watermark and -2147221005<>Err and isexist(l1) then '-2147221005<>Err 检测aspjpeg组件有没有安装 else exit sub end if if len(king_regkey)>0 then I1.regkey =king_regkey I1.open server.mappath(l1) set I2=server.createobject(king_jpeg)'水印图片 if len(king_regkey)>0 then I2.regkey =king_regkey I2.open server.mappath("../../"&king_templates&"/images/watermark.gif") ... 为了让上传图片自动打水印我改了[后台/system/manage.asp]文件 case"upfile" king.clearol king.ol="<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />" king.ol="<style type=""text/css"">*{margin:0px;padding:0px;}</style>" if instr(lcase(request.servervariables("content_type")),"multipart/form-data") then upload.FileType=ftype upload.SavePath="" if right(path,1)<>"/" then path=path&"/" if upload.save("upfile",path&upload.form("upfile_name")) then'成功上传 filecate= upload.form("upfile_name") filecate=king.filecate(LCase(right(filecate,(len(filecate)-instrrev(filecate,"."))))) if filecate="img" then'图片 'king.watermark(path&upload.form("upfile_name")) end if king.txt "<script>window.parent.posthtm('../system/manage.asp?action=filemanage','aja','path="&server.urlencode(path&upload.form("upfile_name"))&"&type="&ftype&"&formname="&formname&"');window.parent.display('flo');</script>"'king.lang("'上传成功'") else back="../system/manage.asp?action=upfile&path="&server.urlencode(path)&"&type="&ftype&"&formname="&formname&"" king.txt"<p style=""font-size:12px;line-height:22px;"">"&king.lang("error/upfile/err"&upload.error)&"<br/><a style=""color:#000;"" href="""&back&""">"&king.lang("common/back")&"</a></p>" end if
Ta最近还发表过
[疑问]
sp2留言修改疑问
(18-03-18)
[使用]
php的栏目一级列表显示二级内容列表的方法
(17-12-10)
[使用]
关于TAG的一些知识
(15-11-23)
[分享]
分类你懂的
(14-08-07)
[疑问]
请问这两个页面有不一样的功能吗?
(14-07-25)
随机阅读
[疑问]
KingCMS(PHP)能不能做商城模块
(13-07-07)
[分享]
2013年站长和SEO应该如何应对百度算法更新
(13-03-02)
[分享]
没有广告的模板多清亮
(12-03-03)
[疑问]
请问如何扩展新功能,若是模块,望赐教大致开发流程
(11-11-22)
[其他]
这么多蛋……
(11-08-18)
|
无聊的飞翔 | 发表于:11-11-26 21:22 编辑于:11-26 21:22 沙发 [回复] #Top# |
---|---|
![]() ![]() ![]() ![]() ![]() ![]() |
收藏了一个KingCMS完美解决本地上传图片加水印,整理一下,有需要的时候试试。
客户要求所上传的图片都要加上公司的LOGO或者文字水印,但是使用KingCMS5.1没有这个功能,也许是程序BUG吧。因为KingCMS的水印功能只有在采集文章,或者复制远程图片时才会自动加上水印,本地上传的图片不会加上的,KingCMS本地上传图片加水印修改如下 打开 [后台/system/manage.asp]文件,大概是在124行吧, 找到if upload.save("upfile",path&upload.form("upfile_name")) then'成功上传,然后在下面加上以下代码: filecate= upload.form("upfile_name") filecate=king.filecate(LCase(right(filecate,(len(filecate)-instrrev(filecate,"."))))) if filecate="img" then king.watermark(path&upload.form("upfile_name")) end if 注意:水印图片路径位置修改请找到page/system/fun.asp文件的1511行,代码如下: I2.open server.mappath("../../"&king_templates&"/image/watermark.gif") 需要注意的是,上传的图片宽度及高度必须大于 watermark.gif 才会加上水印的! 另,用FC编辑器上传的图片还是没有加上水印,这个问题留待解决,现在客户不需要,也就不理会了! |
1Next >