phpcms v9删除上传图片自动添加水印功能
发布:smiling 来源: PHP粉丝网 添加日期:2014-11-27 11:27:25 浏览: 评论:0
自动添加水印功能其实是一个不错的功能,但是今天有一朋友问我可不可以去除flashupload网络文件上传选项及去掉自动添加水印功能呢,下面整理了两个例子,大家一起来看看吧.
去除flashupload网络文件上传选项及去掉自动添加水印功能
第一步:修改wwwroot\phpcms\modules\attachment\templates\swfupload.tpl.php,代码如下:
- <div class="pad-10">
- <div class="col-tab">
- <ul class="tabBut cu-li">
- <li id="tab_swf_1" <?php echo $tab_status?> onclick="SwapTab('swf','on','',5,1);"><?php echo L('upload_attachment')?></li>
- //删除以下
- <strong><span style="color: #ff0000;"> <li id="tab_swf_2" onclick="SwapTab('swf','on','',5,2);"><?php echo L('net_file')?></li></span></strong>
- <?php if($allowupload && $this->admin_username && $_SESSION['userid']) {?>
- <li id="tab_swf_3" onclick="SwapTab('swf','on','',5,3);set_iframe('album_list','index.php?m=attachment&c=attachments&a=album_load&args=<?php echo $args?>');"><?php echo L('gallery')?></li>
- <li id="tab_swf_4" onclick="SwapTab('swf','on','',5,4);set_iframe('album_dir','index.php?m=attachment&c=attachments&a=album_dir&args=<?php echo $args?>');"><?php echo L('directory_browse')?></li>
- <?php }?>
- <?php if($att_not_used!='') {?>
- <li id="tab_swf_5" class="on icon" onclick="SwapTab('swf','on','',5,5);"><?php echo L('att_not_used')?></li>
- <?php }?>
- </ul>
- <div id="div_swf_1" class="content pad-10 <?php echo $div_status?>">
- <div>
- <div class="addnew" id="addnew">
- <span id="buttonPlaceHolder"></span>
- </div>
- <input type="button" id="btupload" value="<?php echo L('start_upload')?>" onClick="swfu.startUpload();" />
- <div id="nameTip" class="onShow"><?php echo L('upload_up_to')?><font color="red"> <?php echo $file_upload_limit?></font> <?php echo L('attachments')?>,<?php echo L('largest')?> <font color="red"><?php echo $file_size_limit?></font></div>
- <div class="bk3"></div>
- <div class="lh24"><?php echo L('supported')?> <font style="font-family: Arial, Helvetica, sans-serif"><?php echo str_replace(array('*.',';'),array('','、'),$file_types)?></font> <?php echo L('formats')?></div>
- //删除下面的水印
- <input type="checkbox" id="watermark_enable" value="1" <?php if(isset($watermark_enable) &&$watermark_enable == 1) echo 'checked'?> onclick="change_params()"> <?php echo L('watermark_enable')?>
- </div>
- <div class="bk10"></div>
- <fieldset class="blue pad-10" id="swfupload">
- <legend><?php echo L('lists')?></legend>
- <ul class="attachment-list" id="fsUploadProgress">
- </ul>
- </fieldset>
- </div>
- <span style="color: #ff0000;"><strong> <div id="div_swf_2" class="contentList pad-10 hidden">
- <div class="bk10"></div>
- <?php echo L('enter_address')?><div class="bk3"></div><input type="text" name="info[filename]" class="input-text" value="" style="width:350px;" onblur="addonlinefile(this)">
- <div class="bk10"></div>
- </div> </strong> </span>
- <?php if($allowupload && $this->admin_username && $_SESSION['userid']) {?>
- <div id="div_swf_3" class="contentList pad-10 hidden">
- <ul class="attachment-list">
- <iframe name="album-list" src="#" frameborder="false" scrolling="no" style="overflow-x:hidden;border:none" width="100%" height="345" allowtransparency="true" id="album_list"></iframe>
- </ul>
- </div>
- <div id="div_swf_4" class="contentList pad-10 hidden">
- <ul class="attachment-list">
- <iframe name="album-dir" src="#" frameborder="false" scrolling="auto" style="overflow-x:hidden;border:none" width="100%" height="330" allowtransparency="true" id="album_dir"></iframe>
- </ul>
- </div>
- <?php }?>
- <?php if($att_not_used!='') {?>
- <div id="div_swf_5" class="contentList pad-10">
- <div class="explain-col"><?php echo L('att_not_used_desc')?></div>
- <ul class="attachment-list" id="album">
- <?php if(is_array($att) && !emptyempty($att)){ foreach ($att as $_v) {?>
- <li>
- <div class="img-wrap">
- <a onclick="javascript:album_cancel(this,<?php echo $_v['aid']?>,'<?php echo $_v['src']?>')" href="javascript:;" class="off" title="<?php echo $_v['filename']?>"><div class="icon"></div><img width="<?php echo $_v['width']?>" path="<?php echo $_v['src']?>" src="<?php echo $_v['fileimg']?>" title="<?php echo $_v['filename']?>"></a>
- </div>
- </li>
- <?php }}?>
- </ul>
- </div>
- <?php }?>
- <div id="att-status" class="hidden"></div>
- <div id="att-status-del" class="hidden"></div>
- <div id="att-name" class="hidden"></div>
- <!-- swf -->
- </div>
补充:彻底去除自带的水印功能
第一步:找到statics/images/water 文件夹,将去删除,如果系统找不到water文件夹的水印图片,则将会执行第二步,给图片添加一个文本格式的水印.
第二步:找到phpcms/libs/classes/image.class.php文件中watermark函数,将此函数中$w_text 参数的值设置为空即可,代码如下:
- function watermark($source, $target = '', $w_pos = '', $w_img = '', $w_text = '',$w_font = 8, $w_color = '#ff0000') {
- $w_pos = $w_pos ? $w_pos : $this->w_pos;
- $w_img = $w_img ? $w_img : $this->w_img;
- if(!$this->watermark_enable || !$this->check($source)) return false;
- if(!$target) $target = $source;//开源软件:phpfensi.com
- $w_img = PHPCMS_PATH.$w_img;
- $source_info = getimagesize($source);
- $source_w = $source_info[0];
- $source_h = $source_info[1];
如果想替换为自己设计的水印图片,则只需要替换statics/images/water文件夹下的水印图片为自己设计的水印图片即可.
如果想给自己上传的图片添加文本格式的水印,则除了需要删除statics/images/water文件夹外,还需要将watermark函数中的$w_text参数的值修改为自己想要的文字即可.
Tags: phpcms水印功能 phpcms自动添加
相关文章
- ·【phpcms-v9】怎样彻底去除v9系统自带的水印功能(2014-10-23)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)