當前位置: 首頁>>代碼示例>>PHP>>正文


PHP image::getremoteimage方法代碼示例

本文整理匯總了PHP中image::getremoteimage方法的典型用法代碼示例。如果您正苦於以下問題:PHP image::getremoteimage方法的具體用法?PHP image::getremoteimage怎麽用?PHP image::getremoteimage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在image的用法示例。


在下文中一共展示了image::getremoteimage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: image

} else {
    if (!$userc->gotpermission('can_upload')) {
        $no_upload = true;
    }
}
if ($no_upload) {
    print "You do not have permission to upload.";
    exit;
}
if (isset($_POST['submit'])) {
    $image = new image();
    $uploaded_image = false;
    $parent = '';
    $error = '';
    if (empty($_FILES['upload']) && isset($_POST['source']) && $_POST['source'] != "" && substr($_POST['source'], 0, 4) == "http" || $_FILES['upload']['error'] != 0 && isset($_POST['source']) && $_POST['source'] != "" && substr($_POST['source'], 0, 4) == "http") {
        $iinfo = $image->getremoteimage($_POST['source']);
        if ($iinfo === false) {
            $error = $image->geterror() . "<br />Could not add the image.";
        } else {
            $uploaded_image = true;
        }
    } else {
        if (!empty($_FILES['upload']) && $_FILES['upload']['error'] == 0) {
            $iinfo = $image->process_upload($_FILES['upload']);
            if ($iinfo === false) {
                $error = $image->geterror() . "<br />An error occured. The image could not be added because it already exists or it is corrupted.";
            } else {
                $uploaded_image = true;
            }
        } else {
            print "No image given for upload.";
開發者ID:xfirespeed,項目名稱:TyP-Gallery,代碼行數:31,代碼來源:post_add.php

示例2: scandir

    if (is_dir($path . $folder) && $folder != "." && $folder != "..") {
        $cur_folder[] = $folder;
        $tags2[] = $folder;
    }
}
$i = 0;
foreach ($cur_folder as $current_folder) {
    //Check for images in folder and add them one by one.
    $files = scandir($path . $current_folder);
    foreach ($files as $file) {
        $extension = explode(".", $file);
        if ($extension['1'] == "jpg" || $extension['1'] == "jpeg" || $extension['1'] == "png" || $extension['1'] == "bmp" || $extension['1'] == "gif") {
            $uploaded_image = false;
            //Extension looks good, toss it through the image processing section.
            $dl_url = $site_url . $path . rawurlencode($current_folder) . "/" . rawurlencode($file);
            $iinfo = $image->getremoteimage($dl_url);
            if ($iinfo === false) {
                $error = $image->geterror() . "<br />Could not add the image.";
            } else {
                $uploaded_image = true;
            }
            //Ok, download of image was successful! (yay?)
            if ($uploaded_image == true) {
                $iinfo = explode(":", $iinfo);
                $tclass = new tag();
                $misc = new misc();
                $ext = strtolower(substr($iinfo[1], -4, 10000));
                $source = $db->real_escape_string(htmlentities($_POST['source'], ENT_QUOTES, 'UTF-8'));
                $title = $db->real_escape_string(htmlentities($_POST['title'], ENT_QUOTES, 'UTF-8'));
                $tags = strtolower($db->real_escape_string(str_replace('%', '', htmlentities($tags2[$i], ENT_QUOTES, 'UTF-8'))));
                $ttags = explode(" ", $tags);
開發者ID:logtcn,項目名稱:gelbooru-fork,代碼行數:31,代碼來源:batch_add.php


注:本文中的image::getremoteimage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。