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


PHP sendImage函數代碼示例

本文整理匯總了PHP中sendImage函數的典型用法代碼示例。如果您正苦於以下問題:PHP sendImage函數的具體用法?PHP sendImage怎麽用?PHP sendImage使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


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

示例1: sendErrorImageAndDie

function sendErrorImageAndDie($cerr)
{
    $new = imageCreate(600, 30);
    $bgc = imageColorAllocate($new, 255, 255, 255);
    $tc = imageColorAllocate($new, 0, 0, 0);
    imageFilledRectangle($new, 0, 0, 150, 30, $bgc);
    imageString($new, 5, 5, 5, "Error: {$cerr}", $tc);
    sendImage($new);
    die;
}
開發者ID:adamisom,項目名稱:chessimager,代碼行數:10,代碼來源:ChessImagerUtils.php

示例2: min

                if ($total_width <= $break_point) {
                    $resolution = $break_point;
                }
            }
        }
    }
}
/* No resolution was found (no cookie or invalid cookie) */
if (!$resolution) {
    // We send the lowest resolution for mobile-first approach, and highest otherwise
    $resolution = $is_mobile ? min($resolutions) : max($resolutions);
}
/* if the requested URL starts with a slash, remove the slash */
if (substr($requested_uri, 0, 1) == "/") {
    $requested_uri = substr($requested_uri, 1);
}
/* whew might the cache file be? */
$cache_file = $document_root . "/{$cache_path}/{$resolution}/" . $requested_uri;
/* Use the resolution value as a path variable and check to see if an image of the same name exists at that path */
if (file_exists($cache_file)) {
    // it exists cached at that size
    if ($watch_cache) {
        // if cache watching is enabled, compare cache and source modified dates to ensure the cache isn't stale
        $cache_file = refreshCache($source_file, $cache_file, $resolution);
    }
    sendImage($cache_file, $browser_cache);
}
/* It exists as a source file, and it doesn't exist cached - lets make one: */
$file = generateImage($source_file, $cache_file, $resolution);
sendImage($file, $browser_cache);
開發者ID:vishalishere,項目名稱:accessyoutube,代碼行數:30,代碼來源:adaptive-images.php

示例3: strlen

// but I understand that in professional environments, your boss might not like this tag
// so that's cool.
$tag_str = "freeCap v1.41 - puremango.co.uk";
// for debug:
//$tag_str = "[".$word."]";
// ensure tag is right-aligned
$tag_width = strlen($tag_str) * 6;
// write tag
ImageString($im, 2, $width - $tag_width, $height - 13, $tag_str, $tag_col);
// unset all sensetive vars
// in case someone include()s this file on a shared server
// you might think this unneccessary, as it exit()s
// but by using register_shutdown_function
// on a -very- insecure shared server, they -might- be able to get the word
unset($word);
// the below aren't really essential, but might aid an OCR attack if discovered.
// so we unset them
unset($use_dict);
unset($dict_location);
unset($max_word_length);
unset($bg_type);
unset($bg_images);
unset($merge_type);
unset($bg_fade_pct);
unset($morph_bg);
unset($col_type);
unset($max_attempts);
unset($font_locations);
// output final image :-)
sendImage($im);
// (sendImage also destroys all used images)
開發者ID:par-orillonsoft,項目名稱:phpwebsite,代碼行數:31,代碼來源:freecap.php

示例4: var_dump

     //$target=array("122633509780062768");
     $action = "Hello HuanXin!";
     $ext['a'] = "a";
     $ext['b'] = "b";
     var_dump(sendCmd($from, $target_type, $target, $action, $ext));
     break;
 case 37:
     //發送圖片消息
     $filePath = "./resource/up/pujing.jpg";
     $from = 'admin';
     $target_type = "users";
     $target = array("zhangsan", "lisi");
     $filename = "pujing.jpg";
     $ext['a'] = "a";
     $ext['b'] = "b";
     var_dump(sendImage($filePath, $from, $target_type, $target, $filename, $ext));
     break;
 case 38:
     //發送語音消息
     $filePath = "./resource/up/mangai.mp3";
     $from = 'admin';
     $target_type = "users";
     $target = array("zhangsan", "lisi");
     $filename = "mangai.mp3";
     $length = 10;
     $ext['a'] = "a";
     $ext['b'] = "b";
     var_dump(sendAudio($filePath, $from = "admin", $target_type, $target, $filename, $length, $ext));
     break;
 case 39:
     //發送視頻消息
開發者ID:lzstg,項目名稱:emchat,代碼行數:31,代碼來源:easemobtest.php

示例5: strlen

// but I understand that in professional environments, your boss might not like this tag
// so that's cool.
$tag_str = "freeCap v1.41 - puremango.co.uk";
// for debug:
//$tag_str = "[".$word."]";
// ensure tag is right-aligned
$tag_width = strlen($tag_str) * 6;
// write tag
ImageString($GLOBALS['im1'], 2, $width - $tag_width, $height - 13, $tag_str, $tag_col);
// unset all sensetive vars
// in case someone include()s this file on a shared server
// you might think this unneccessary, as it exit()s
// but by using register_shutdown_function
// on a -very- insecure shared server, they -might- be able to get the word
unset($word);
// the below aren't really essential, but might aid an OCR attack if discovered.
// so we unset them
unset($use_dict);
unset($dict_location);
unset($max_word_length);
unset($bg_type);
unset($bg_images);
unset($merge_type);
unset($bg_fade_pct);
unset($morph_bg);
unset($col_type);
unset($max_attempts);
unset($font_locations);
// output final image :-)
sendImage($GLOBALS['im1']);
// (sendImage also destroys all used images)
開發者ID:b007patel,項目名稱:bbaero-site,代碼行數:31,代碼來源:freecap.php

示例6: getBoardDirection

<?php

require_once "./ChessImagerUtils.php";
$direction = getBoardDirection();
$board = makeBoardImage($direction);
$pieceArray = parseFenString($_GET['fen']);
for ($square = 0; $square < 64; $square++) {
    mergePiece($board, $pieceArray[$square], $square, $direction);
}
sendImage($board);
開發者ID:adamisom,項目名稱:chessimager,代碼行數:10,代碼來源:ChessImager.php

示例7: catch

try {
    $res = $search->search("ecatalogue", $columns, $terms);
} catch (Exception $e) {
    //echo "$e";
    sendError(406);
}
if (isset($res->rows[0]["image"]["resource"])) {
    $img = $res->rows[0]["image"]["resource"];
} else {
    sendError(404);
}
$temp_img = tempnam(sys_get_temp_dir(), 'IMU');
saveImg($temp_img, $img);
$fn = $img["identifier"];
$mime = $img["mimeFormat"];
sendImage($temp_img, $mime, $fn);
function saveImg($newloc, $image)
{
    // Save a copy of the resource
    $temp = $image['file'];
    $copy = fopen($newloc, 'wb');
    for (;;) {
        $data = fread($temp, 4096);
        // read 4K at a time
        if ($data === false || strlen($data) == 0) {
            break;
        }
        fwrite($copy, $data);
    }
    fclose($copy);
}
開發者ID:CMP-Studio,項目名稱:IMuAPI,代碼行數:31,代碼來源:index.php

示例8: exit

    exit();
  }
}

// save the new file in the appropriate path, and send a version to the browser
switch ($extension){
  case 'png':
    $gotSaved = ImagePng($dst, "$document_root/$cache_path/$resolution/$directories/$requested_file");
  break;
  case 'gif':
    $gotSaved = ImageGif($dst, "$document_root/$cache_path/$resolution/$directories/$requested_file");
  break;
  default:
    $gotSaved = ImageJpeg($dst, "$document_root/$cache_path/$resolution/$directories/$requested_file", $jpg_quality);
  break;
}

if(!$gotSaved) {
  /* Couldn't save image, notify the client by way of throwing a message in a bottle, as that's all we can do */
  $im         = ImageCreateTrueColor(800, 200);
  $text_color = ImageColorAllocate($im, 233, 14, 91);
  ImageString($im, 1, 5, 5,  "Failed to create directories: $document_root/$cache_path/$resolution/$directories", $text_color);
  header('Content-Type: image/jpeg');
  ImageJpeg($im); ImageDestroy($im);
  exit();
}
else { // we saved the image to cache, now deliver the image to the client
  ImageDestroy($src); ImageDestroy($dst);
  sendImage("$document_root/$cache_path/$resolution/$directories/$requested_file",$mime_type,$browser_cache);
}
?>
開發者ID:noobite,項目名稱:Workless,代碼行數:31,代碼來源:adaptive-images.php


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