示例#1
0
/**
 * 文件上传
 * @param array $files
 * @param array $config
 * @return array
 */
function upload($files, $config = array())
{
    $config = array_merge(C('FILE_UPLOAD_CONFIG'), $config);
    $upload = new Think\Upload($config);
    $res = $upload->upload($files);
    if ($res) {
        foreach ($res as $arr) {
            $filename = UPLOAD_PATH . $arr['savepath'] . $arr['savename'];
            if (C('IMAGE_WATER_CONFIG.status') && strpos($arr['type'], 'image') !== false) {
                image_water($filename);
            }
        }
        return array('status' => 1, 'info' => '上传成功', 'result' => $res);
    } else {
        return array('status' => 0, 'info' => $upload->getError(), 'result' => null);
    }
}
示例#2
0
 private function markpic($dst = null)
 {
     //取水印图片
     $src = realpath('.' . get_picture(C('SHUIYIN_IMG')));
     $shuiyinon = C('SHUIYIN_ON');
     if ($shuiyinon == '1' && $dst !== false && $src !== false) {
         image_water($dst, $src, $dst);
     } else {
         if ($shuiyinon == '2' && $dst !== false && $src !== false) {
             image_water($dst, '', $dst, C('SHUIYIN_TEXT'));
         }
     }
 }