<div class="form-group row">
    <label class="col-sm-1 col-form-label" for="example">水印</label>
    <div class="col-sm-8">
        <input type="checkbox" data-toggle="switch" name="config[watermark][enable]" id="watermark_enable" <?php echo $config['watermark']['enable'] ? 'checked' : '' ; ?> />
        <small class="form-text text-muted">将在上传的图片附件中加上您在下面设置的图片或文字水印</small>
    </div>
</div>
<div class="form-group row">
    <label class="col-sm-1 col-form-label" for="example">水印模式</label>
    <div class="col-sm-8">
        <div class="custom-control custom-radio custom-control-lg custom-control-inline">
            <input v-model="watermark_mode" type="radio" class="custom-control-input" id="watermark_mode1" name="config[watermark][mode]" value="1" checked>
            <label class="custom-control-label" for="watermark_mode1">马赛克</label>
        </div>
        <div class="custom-control custom-radio custom-control-lg custom-control-inline">
            <input v-model="watermark_mode" type="radio" class="custom-control-input" id="watermark_mode2" name="config[watermark][mode]" value="0">
            <label class="custom-control-label" for="watermark_mode2">水印</label>
        </div>
    </div>
</div>
<div v-show="watermark_mode=='0'">
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">水印位置</label>
        <div class="col-sm-8">
            <select v-model="watermark_pos" name="config[watermark][pos]" id="watermark_pos" class="form-control">
                <option value="0">随机位置</option>
                <option value="1">顶部居左</option>
                <option value="2">顶部居中</option>
                <option value="3">顶部居右</option>
                <option value="4">中部居左</option>
                <option value="5">中部居中</option>
                <option value="6">中部居右</option>
                <option value="7">底部居左</option>
                <option value="8">底部居中</option>
                <option value="9">底部居右</option>
                <option value="-1">自定义</option>
            </select>
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">位置偏移</label>
        <div class="col-sm-8">
            <div class="input-group">
                <div class="input-group-prepend"><span class="input-group-text">X</span></div>
                <input type="text" name="config[watermark][x]" class="form-control" id="watermark_x" value="<?php echo $config['watermark']['x']; ?>" />
                <div class="input-group-append"><span class="input-group-text">Y</span></div>
                <input type="text" name="config[watermark][y]" class="form-control" id="watermark_y" value="<?php echo $config['watermark']['y']; ?>" />
            </div>
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">图片尺寸</label>
        <div class="col-sm-8">
            <div class="input-group">
                <div class="input-group-prepend"><span class="input-group-text">宽度</span></div>
                <input type="text" name="config[watermark][width]" class="form-control" id="watermark_width" value="<?php echo $config['watermark']['width']; ?>" />
                <div class="input-group-append"><span class="input-group-text">高度</span></div>
                <input type="text" name="config[watermark][height]" class="form-control" id="watermark_height" value="<?php echo $config['watermark']['height']; ?>" />
            </div>
            <small class="form-text text-muted">单位:像素(px) 只对超过程序设置的大小的附件图片才加上水印图片或文字(设置为0不限制)</small>
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">图片类型</label>
        <div class="col-sm-8">
            <input type="text" name="config[watermark][allow_ext]" class="form-control" id="watermark_allow_ext" value="<?php echo $config['watermark']['allow_ext']; ?>" />
            <small class="form-text text-muted">需要添加水印的图片类型(jpg,jpeg,png) 注:当前版本gif动画添加水印将失效</small>
        </div>
    </div>
    <hr />
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">水印图片文件</label>
        <div class="col-sm-8">
            <input type="text" name="config[watermark][img]" class="form-control" id="watermark_img" value="<?php echo $config['watermark']['img']; ?>" />
            <small class="form-text text-muted">水印图片存放路径：/config/<?php echo iPHP_APP_SITE;?>/watermark.png， 如果水印图片不存在，则使用文字水印</small>
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">水印透明度</label>
        <div class="col-sm-8">
            <input type="text" name="config[watermark][transparent]" class="form-control" id="watermark_transparent" value="<?php echo $config['watermark']['transparent']; ?>" />
        </div>
    </div>
    <hr />
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">水印文字</label>
        <div class="col-sm-8">
            <input type="text" name="config[watermark][text]" class="form-control" id="watermark_text" value="<?php echo $config['watermark']['text']; ?>" />
            <small class="form-text text-muted">如果设置为中文,字体文件必需要支持中文字体 ,存放路径：/config/<?php echo iPHP_APP_SITE;?>/iCMS/</small>
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">文字字体</label>
        <div class="col-sm-8">
            <input type="text" name="config[watermark][font]" class="form-control" id="watermark_font" value="<?php echo $config['watermark']['font']; ?>" />
            <small class="form-text text-muted">字体文件</small>
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">水印文字字体大小</label>
        <div class="col-sm-8">
            <input type="text" name="config[watermark][fontsize]" class="form-control" id="watermark_fontsize" value="<?php echo $config['watermark']['fontsize']; ?>" />
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">水印文字颜色</label>
        <div class="col-sm-8">
            <input type="text" name="config[watermark][color]" class="form-control" id="watermark_color" value="<?php echo $config['watermark']['color']; ?>" />
            <small class="form-text text-muted">例#000000 长度必须7位</small>
        </div>
    </div>
</div>
<div v-show="watermark_mode=='1'">
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">马赛克尺寸</label>
        <div class="col-sm-8">
            <div class="input-group">
                <div class="input-group-prepend"><span class="input-group-text">宽度</span></div>
                <input type="text" name="config[watermark][mosaics][width]" class="form-control" id="watermark_mosaics_width" value="<?php echo $config['watermark']['mosaics']['width'] ?: 150; ?>" />
                <div class="input-group-append"><span class="input-group-text">高度</span></div>
                <input type="text" name="config[watermark][mosaics][height]" class="form-control" id="watermark_mosaics_height" value="<?php echo $config['watermark']['mosaics']['height'] ?: 90; ?>" />
            </div>
        </div>
    </div>
    <div class="form-group row">
        <label class="col-sm-1 col-form-label" for="example">马赛克深度</label>
        <div class="col-sm-8">
            <input type="text" name="config[watermark][mosaics][deep]" class="form-control" id="watermark_mosaics_deep" value="<?php echo $config['watermark']['mosaics']['deep'] ?: 9; ?>" />
        </div>
    </div>
</div>
<!--
<div class="form-group row">

<label class="col-sm-1 col-form-label" for="example">缩略图水印</label>
<div class="col-sm-8">
    <div class="switch">
        <input type="checkbox" data-toggle="switch" name="config[watermark][thumb]" id="watermark_thumb" <?php echo $config['watermark']['thumb'] ? 'checked' : ''; ?>/>
    </div>
<small class="form-text text-muted">开启时缩略图也会打上水印</small>
</div>
</div>
-->
<script>
iCMS.set('Vue.data',{
    watermark_mode: "<?php echo (int) $config['watermark']['mode']; ?>",
    watermark_pos: "<?php echo (int) $config['watermark']['pos']; ?>",
});
</script>
