我试图限制画布内的移动物体,但我在顶部和左侧移动具有限制区域的物体时遇到一些困难,当我缩放具有大尺寸的物体时,我也无法限制移动物体画布的左侧和顶侧
canvas.observe("object:moving", function(e){
var obj = e.target;
// if object is too big ignore
if(obj.currentHeight > obj.canvas.height || obj.currentWidth > obj.canvas.width){
return;
}
var halfw = obj.currentWidth/2;
var halfh = obj.currentHeight/2;
var bounds = {tl: {x: halfw, y:halfh},
br: {x: obj.canvas.width-halfw, y: obj.canvas.height-halfh}
};
// top-left corner
if(obj.top < bounds.tl.y || obj.left < bounds.tl.x){
obj.top = Math.max(obj.top, bounds.tl.y);
obj.left = Math.max(obj.left, bounds.tl.x )
}
// bot-right corner
if(obj.top > bounds.br.y || obj.left > bounds.br.x){
obj.top = Math.min(obj.top, bounds.br.y);
obj.left = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用php api在列表中添加联系人,但它正在抛出波纹管代码片段错误
string(51)"{"errors":[{"message":"请求正文无效"}]}"{"email":"hello@test.com","first_name":"hh","last_name" :"用户"}
我使用的是以下代码段:
$url = 'https://api.sendgrid.com/v3';
$request = $url.'/contactdb/lists/12345/recipients'; //12345 is list_id
$params = array(
'email' => 'hello@test.com',
'first_name' => 'hh',
'last_name' => 'User'
);
$json_post_fields = json_encode($params);
// Generate curl request
$ch = curl_init();
$headers =
array("Content-Type: application/json",
"Authorization: Bearer SG.XXXXXXXX");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_URL, $request);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
// Apply the JSON to our curl call
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_post_fields);
$data = curl_exec($ch);
if (curl_errno($ch)) {
print "Error: " . …Run Code Online (Sandbox Code Playgroud) 我必须.aspx从PHP代码中打一个页面网址我正在尝试使用curl但是我收到了波纹管错误并且网址中没有空白区域.
HTTP/1.1 400 Bad Request Content-Type: text/html; charset=us-ascii Server: Microsoft-HTTPAPI/2.0 Date: Mon, 05 Oct 2015 08:31:13 GMT Connection: close Content-Length: 311
Run Code Online (Sandbox Code Playgroud)
贝娄是我想要击中的卷曲代码.任何身体都会告诉我为什么会出现这个错误.
$api_url = 'http://www.test/xyz/OnlineOrder.aspx?';
$url= $api_url . 'InvoiceNo=' . $invoice;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
echo $data = curl_exec($ch);
echo $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
Run Code Online (Sandbox Code Playgroud) 我为用户创建了自定义用户分类法,并且它对单一分类法有效.
从Bellow参考指南我创建了自定义用户分类.
参考指南: - http://justintadlock.com/archives/2011/10/20/custom-user-taxonomies-in-wordpress
贝娄是分类学的结构
(registered taxonomy) profession
Dietitian (under the profession )
(registered taxonomy) city
NewYork(under the city)
Run Code Online (Sandbox Code Playgroud)
我的slu name名称 expert
在这里,我想显示用户Dietitian在NewYorkcity中的过滤结果.因此,它将显示在配置文件中选择了上述选项的所有用户.
现在我想要www.test.com/expert/dietitian/newyork
用户在用户配置文件中选择了Dietitian,NewYork 的url .是否有任何解决方案可以结合使用Dietitian,NewYork
单个术语的网址如下: - www.test.com/expert/dietitian/
我试图在我的画布中使用ctx.clip属性绘制一个光滑的椭圆.我已完成绘图部分我面临椭圆弧线清晰度的问题.任何人对此有任何想法让我知道吗?这是我的代码.
<canvas id="c" width="400" height="400"></canvas>
var canvas = new fabric.Canvas('c');
var ctx = canvas.getContext('2d');
var cx=180;
var cy=200;
var w=300;
var h=250;
// Quadratric curves example
ctx.beginPath();
var lx = cx - w/2,
rx = cx + w/2,
ty = cy - h/2,
by = cy + h/2;
var magic = 0.551784;
var xmagic = magic*w/2;
var ymagic = h*magic/2;
ctx.moveTo(cx,ty);
ctx.bezierCurveTo(cx+xmagic,ty,rx,cy-ymagic,rx,cy);
ctx.bezierCurveTo(rx,cy+ymagic,cx+xmagic,by,cx,by);
ctx.bezierCurveTo(cx-xmagic,by,lx,cy+ymagic,lx,cy);
ctx.bezierCurveTo(lx,cy-ymagic,cx-xmagic,ty,cx,ty);
ctx.fill();
ctx.stroke();
ctx.clip();
var text;
text = new fabric.Text('Honey', {
fontSize: 50,
left: 150,
top: …Run Code Online (Sandbox Code Playgroud) 工作模具文本项目我已创建代码将输入文本转换为图像它工作正常,但我有多个文本框(例如)文本框1,文本框2,文本框3.问题是,如果我键入文本框1其转换文本为图像和之后如果我在文本框2或文本框3中键入文本,它将在此处转换新图像我只想在新行中使用文本框1中的第一个图像转换文本创建该文本.
演示链接: - 点击这里
Bellow示例快照.您可以看到第一个文本框包围第1行和第二个文本框在一个图像上的第二行或新行上创建图像.
贝娄是我的代码index.php
<?php ?>
<html>
<body>
<img class="stencil-main" id="stencil-main" />
<span class="line" style="margin-left: 578px;">Enter Text-</span><input type="text" name="stencil-text" style="margin-left: 15px;"
onkeyup="document.getElementById('stencil-main').src='some.php?img='+this.value" />
<br>
<img class="stencil-mains" id="stencil-mains" />
<span class="line" style="margin-left: 578px;">Enter Text-</span><input type="text" name="stencil-text" style="margin-left: 15px;"
onkeyup="document.getElementById('stencil-mains').src='some.php?img='+this.value" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
2)Bellow是用于将文本转换为图像some.php的PHP代码
<?php
header("Content-type: image/png");
$cid=$_GET['img'];
####################### BEGIN USER EDITS #######################
$imagewidth = 500;
$imageheight = 100;
$fontsize = "20";
$fontangle = "0";
$font = "ByzantineEmpire.ttf";
$text = $cid ;
$text2="sanjay";
$backgroundcolor = "FFFFFF";
$textcolor = "#000000";
######################## …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用fabric.js在画布上绘制一个免费的绘图,但我无法在我这边自由绘制像喷雾,圆圈,纹理模式我使用此代码只有铅笔模式绘图工作,但当我选择喷雾和模式绘制为铅笔的其他模式.
这是我的HTML 这里是小提琴墨水
<label for="drawing-mode-selector">Mode:</label>
<select id="drawing-mode-selector">
<option>Pencil</option>
<option>Circle</option>
<option>Spray</option>
<option>Pattern</option>
<option>hline</option>
<option>vline</option>
<option>square</option>
<option>diamond</option>
<option>texture</option>
</select><br>
<label for="drawing-line-width">Line width:</label>
<input type="range" value="30" min="0" max="150" id="drawing- line-width"><br>
<label for="drawing-color">Line color:</label>
<input type="color" value="#005E7A" id="drawing-color"><br>
<label for="drawing-shadow-width">Line shadow width:</label>
<input type="range" value="0" min="0" max="50" id="drawing-shadow-width"><br>
</div>
</li>
Run Code Online (Sandbox Code Playgroud)
这是我的脚本代码
var canvas = new fabric.Canvas('canvas')
var drawingModeEl = document.getElementById('drawing-mode'),
drawingOptionsEl = document.getElementById('drawing-mode-options'),
drawingColorEl = document.getElementById('drawing-color'),
drawingLineWidthEl = document.getElementById('drawing-line-width'),
drawingShadowWidth = document.getElementById('drawing-shadow-width');
drawingModeEl.onclick = function() {
canvas.isDrawingMode = !canvas.isDrawingMode;
if (canvas.isDrawingMode) {
drawingModeEl.innerHTML = …Run Code Online (Sandbox Code Playgroud) 我有两个用户角色
1) 供应商 2) 免费供应商
在这里,我试图通过用户角色vendor和freevendor波纹管代码获取用户,但查询仅获取freevendor。
$vendor_total_args = array (
'role' => 'vendor',
'role' => 'freevendor',
'orderby' => $orderby,
'order' => $order,
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'pv_merchant__experiance_dropdwon',
'value' => $_POST[ 'pv_merchant__experiance_dropdwon1' ],
'compare' => 'LIKE'
),
array(
'key' => 'pv_merchant_specialization',
'value' => $_POST[ 'pv_merchant__experiance_dropdwon2' ],
'compare' => 'LIKE'
)
)
);
Run Code Online (Sandbox Code Playgroud)
那么我如何获取多个用户角色 vendor并freevendor使用上面的代码片段。
这是我的代码
$("#textbackground").click(function() {
var obj = canvas.getActiveObject();
![enter image description here][1]
//alert("weight");
if (!obj) return;
obj.setTextBackgroundColor('rgb(0,200,0)');
canvas.renderAll();
});
Run Code Online (Sandbox Code Playgroud)
我必须将背景颜色设置为仅文本,像这样的链接,但我得到正方形文本的背景颜色,而不是文本只 在这里输入链接描述
那我怎么设置
obj.setTextBackgroundColor('rgb(0,200,0)');
Run Code Online (Sandbox Code Playgroud) 我有以下多个交易传递给交易string:
string transaction = "12345,56789";
Run Code Online (Sandbox Code Playgroud)
我想检查该交易是否具有前缀“0”,那么如何检查。
例如
"012345,056789";
Run Code Online (Sandbox Code Playgroud)
假设这些交易没有像"12345,56789"这样的前缀 '0'我想添加像这样的前缀"012345,056789"。
我尝试使用下面的代码它对我不起作用,任何人都可以指导我如何实现这一目标。
if(transaction.StartsWith("0"))
{
transaction = transaction;
}
else
{
transaction = "0" + transaction;
}
Run Code Online (Sandbox Code Playgroud) 我有按字按网站,我在AWS服务器上安装了Mod页面。
我已经使用combining_css,combine_javascript过滤器,但是它没有在同一行中将js和css组合在一起,而是在不同的组中进行组合。
因此,我想将我的js,css文件合并为2个不同文件(如js和css)的一行。
我已经尝试在/pagespeed.conf文件中设置波纹管,但是它不起作用
我的页面速度设置:-
ModPagespeedRewriteLevel PassThrough
ModPagespeedEnableFilters add_head,combine_css,combine_javascript,convert_meta_tags,extend_cache,fallback_rewrite_css_urls,flatten_css_imports,inline_css, inline_import_to_link,
inline_javascript,rewrite_css,rewrite_images,rewrite_javascript,rewrite_style_attributes_with_url
ModPagespeedFileCacheSizeKb 102400
ModPagespeedFileCacheCleanIntervalMs 3600000
ModPagespeedLRUCacheKbPerProcess 1024
ModPagespeedLRUCacheByteLimit 16384
ModPagespeedCssFlattenMaxBytes 2048
ModPagespeedCssInlineMaxBytes 2048
ModPagespeedCssImageInlineMaxBytes 0
ModPagespeedImageInlineMaxBytes 3072
ModPagespeedJsInlineMaxBytes 2048
ModPagespeedCssOutlineMinBytes 3000
ModPagespeedJsOutlineMinBytes 3000
ModPagespeedMaxCombinedCssBytes -1
ModPagespeedMaxCombinedJsBytes 92160
ModPagespeedCombineAcrossPaths off
Run Code Online (Sandbox Code Playgroud) 我有功能frm_trigger_entry_update这是在后台运行的PHP功能我的意思是这是一个ajax PHP功能.
在这个函数中,我已经编写了一些jquery或javascript函数,这将是alert一些文本消息.
在下面的代码片段中,您可以看到我的功能代码.
<?php
function frm_trigger_entry_update($atts)
{
//here i have some php code which run properly
}
?>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了下面的代码片段,但它对我来说不起作用意味着在调用此函数后警报框没有显示.
<?php
function frm_trigger_entry_update($atts)
{
//here i have some php code which run properly
?>
<script>
jQuery(document).ready(function($){
alert("my message");
});
</script>
<?php
}
?>
Run Code Online (Sandbox Code Playgroud)
那么如何在这个PHP函数中提醒任何人有任何想法.
我必须按值获取数组的索引元素.
假设我有一个波纹管片段.
Array ( [2671] => 24 [3149] => 1 [3711] => 2 [3695] => 16
[3209] => 53 [3638] => 16 [3671] => 22 [3235] => 19
[3773] => 10 [348] => 1 [3387] => 2 [3787] => 1 [3693] => 1
[3248] => 28 [3816] => 2 [3060] => 3 [3200] => 2 [3741] => 2
[3676] => 26 [3855] => 3 [3196] => 4 [3030] => 1 )
Run Code Online (Sandbox Code Playgroud)
而且我从这个阵列获得最高的3个值作为低于输出.
Top value 53
Top value 28
Top value …Run Code Online (Sandbox Code Playgroud)