utils

package
v0.0.0-...-11555b2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2014 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(src string) string

base64解密

func Base64Encode

func Base64Encode(src []byte) string

base64加密 例如:str := utils.Base64Encode([]byte("Hello, playground"))

func Crop

func Crop(old_img string, new_img string, img_size string) bool

ImageMagick之图片裁剪 http://www.netingcn.com/imagemagick-crop.html

func DecodeSegment

func DecodeSegment(where string) map[string]string

将编码的搜索条件,解码成搜索条件Map数组 where 搜索条件的编码字符串

func EncodeSegment

func EncodeSegment(where map[string]string) string

将搜索条件数组编码成一个字符串 where 搜索条件Map 例如:map转换成格式 name:张三|age:20 然后Base64

func FileSize

func FileSize(size int) string

文件大小

func GetClientIP

func GetClientIP() string

获取客户端IP

func Html2str

func Html2str(html string) string

Html过滤

func In_Array

func In_Array(s string, arr []string) bool

元素是否包含在数组中

func IsDir

func IsDir(path string) bool

是否目录

func IsFile

func IsFile(path string) bool

是否文件

func IsMap

func IsMap(v interface{}) bool

是否Map类型

func Md5

func Md5(s string) string

返回MD5加密

func Negate

func Negate(old_img string, new_img string) bool

imagemagick图片反色处理 http://www.netingcn.com/imagemagick-negate.html

func RandomInt

func RandomInt(min int, max int) int

生成随机数字

func RandomString

func RandomString(num int) string

生成随机字符串

func Resize

func Resize(old_img string, new_img string, img_size string, output_align string, background string) bool

ImageMagick之图片缩放 http://www.netingcn.com/imagemagick-resize.html http://www.imagemagick.org/script/command-line-options.php#thumbnail 参数说明: old_img:原始图片 new_img:新图片 img_size:图片大小 output_align:位置center background:颜色

func Substr

func Substr(str string, length int64) string

按字节截取字符串 utf-8不乱码

func Vignette

func Vignette(old_img string, new_img string, img_size string) bool

生成圆角图片 img_size:0x4 background: none

func WatermarkLogo(old_img string, new_img string, logo_img string) bool

ImageMagicK给图片加水印之图片水印处理 http://www.netingcn.com/imagemagick-mark.html

func WatermarkText

func WatermarkText(old_img string, new_img string) bool

ImageMagicK给图片加水印之文字水印处理

Types

type Page

type Page struct {
	Perpage      int64       //每页显示的条目数
	Nums         int64       //总条目数
	Current_page int64       //当前被选中的页
	Sub_pages    int64       //每次显示的页数
	PageNums     int64       //总页数
	Page_array   map[int]int //用来构造分页的数组
	SubPage_link string      //每个分页的链接
	SubPage_type int8        //显示分页的类型
}

func (*Page) Show

func (P *Page) Show() template.HTML

* 显示分页

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL