本文整理汇总了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;
}
示例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);
示例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)
示例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:
//发送视频消息
示例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)
示例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);
示例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);
}
示例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);
}
?>