当前位置: 首页>>代码示例>>PHP>>正文


PHP image::waterimage方法代码示例

本文整理汇总了PHP中image::waterimage方法的典型用法代码示例。如果您正苦于以下问题:PHP image::waterimage方法的具体用法?PHP image::waterimage怎么用?PHP image::waterimage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在image的用法示例。


在下文中一共展示了image::waterimage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: image

                 } else {
                     if ($DT['water_type'] == 1) {
                         $image = new image(DT_ROOT . '/' . $middle);
                         $image->watertext();
                     }
                 }
             }
         } else {
             if ($from == 'editor') {
                 if ($_groupid == 1 && !isset($watermark)) {
                     $DT['water_type'] = 0;
                 }
                 if ($DT['water_type']) {
                     $image = new image(DT_ROOT . '/' . $do->saveto);
                     if ($DT['water_type'] == 2) {
                         $image->waterimage();
                     } else {
                         if ($DT['water_type'] == 1) {
                             $image->watertext();
                         }
                     }
                 }
             }
         }
     }
 }
 $saveto = linkurl($do->saveto);
 if ($DT['ftp_remote'] && $DT['remote_url']) {
     require DT_ROOT . '/include/ftp.class.php';
     $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
     if ($ftp->connected) {
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:upload.php

示例2: save_local

function save_local($content)
{
    global $DT, $DT_TIME, $_userid;
    if ($content == '<br type="_moz" />') {
        return '';
    }
    //FireFox
    if ($content == '&nbsp;') {
        return '';
    }
    //Chrome
    $content = preg_replace("/allowScriptAccess=\"always\"/i", "", $content);
    $content = preg_replace("/allowScriptAccess/i", "allowscr-iptaccess", $content);
    if (strpos($content, 'data:image') === false) {
        return $content;
    }
    if (!preg_match_all("/src=([\"|']?)([^ \"'>]+)\\1/i", $content, $matches)) {
        return $content;
    }
    require_once DT_ROOT . '/include/image.class.php';
    $dftp = false;
    if ($DT['ftp_remote'] && $DT['remote_url']) {
        require_once DT_ROOT . '/include/ftp.class.php';
        $ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
        $dftp = $ftp->connected;
    }
    $urls = $oldpath = $newpath = array();
    $DT['uploaddir'] or $DT['uploaddir'] = 'Ym/d';
    foreach ($matches[2] as $k => $url) {
        if (in_array($url, $urls)) {
            continue;
        }
        $urls[$url] = $url;
        if (strpos($url, 'data:image') === false) {
            continue;
        }
        if (strpos($url, ';base64,') === false) {
            continue;
        }
        $t1 = explode(';base64,', $url);
        $t2 = explode('/', $t1[0]);
        $file_ext = $t2[1];
        in_array($file_ext, array('jpg', 'gif', 'png')) or $file_ext = 'jpg';
        $filedir = 'file/upload/' . timetodate($DT_TIME, $DT['uploaddir']) . '/';
        $filepath = DT_PATH . $filedir;
        $fileroot = DT_ROOT . '/' . $filedir;
        $filename = timetodate($DT_TIME, 'H-i-s') . '-' . rand(10, 99) . '-' . $_userid . '.' . $file_ext;
        $newfile = $fileroot . $filename;
        if (!is_image($newfile)) {
            continue;
        }
        if (file_put($newfile, base64_decode($t1[1]))) {
            if (!@getimagesize($newfile)) {
                file_del($newfile);
                continue;
            }
            if ($DT['water_type']) {
                $image = new image($newfile);
                if ($DT['water_type'] == 2) {
                    $image->waterimage();
                } else {
                    if ($DT['water_type'] == 1) {
                        $image->watertext();
                    }
                }
            }
            $oldpath[] = $url;
            $newurl = linkurl($filepath . $filename);
            if ($dftp) {
                $exp = explode("file/upload/", $newurl);
                if ($ftp->dftp_put($filedir . $filename, $exp[1])) {
                    $newurl = $DT['remote_url'] . $exp[1];
                    file_del($newfile);
                }
            }
            $newpath[] = $newurl;
        }
    }
    unset($matches);
    return str_replace($oldpath, $newpath, $content);
}
开发者ID:hcd2008,项目名称:destoon,代码行数:81,代码来源:post.func.php


注:本文中的image::waterimage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。