当前位置:首页 » 编程语言 » php头像裁剪

php头像裁剪

发布时间: 2023-02-03 12:41:22

㈠ 能不能给我发一个php上传头像裁剪啊 谢谢 兄弟

ResultCode BSTree<T>::Search1(T &x) const
{
BTNode<T> *p = root;
while(p) {
if(x < p -> element) p = p -> lChild;
else if(x > p -> element) p = p -> rChild;
else {
x = p -> element;
return Success;
}
}
return NotPresent;
}

㈡ 怎么实现php上传图片并可以裁剪的功能,类似一些网站的头像截取,裁剪可以用jcrop插件。高分悬赏

php本身有裁剪图片的函数,js的截取一般是获得几个坐标,供这个函数作为参数,php在图片上传到服务器临时空间的时候,对图片进行裁剪,再按编程人的需求保存到指定目录。

网络下现成的,或者翻翻手册。

㈢ 急求一个可用的 Thinkphp 头像剪裁上传的功能,官网的demo下载链接打不开,急急急!!!

美图秀秀有个这个的插件,挺简单的你可以试试


自己看

㈣ 为什么用PHP对上传图片进行裁剪的时候,没成功,而且连上传的原图都没了

加个base64_decode方法试试:
$src = imagecreatefromstring(base64_decode(file_get_contents($src_path)));

㈤ thinkphp3.1头像剪切上传怎么把jquery剪切好的图片上传保存到数据库

canvas
转成
base64位,然后得到图片的编码,然后上传到数据库

㈥ php求助图片缩放裁切问题

这段代码可以通过自已选择来决定图片的大小!

效果图如下所示:希望对你有帮助!

其中

minSize:[48,48],

setSelect:[0,0,190,190],

是调整选取范围的大小,若你调整为120和160就改为了

setSelect:[0,0,120,160],

就可以了!

<?php
error_reporting(7);
date_default_timezone_set("Asia/Shanghai");
header("Content-type:text/html;Charset=utf-8");
require_once("./image.class.php");

$images=newImages("file");

if($_GET['act']=='cut'){
$image="0000.jpg";
$res=$images->thumb($image,false,1);
if($res==false){
echo"裁剪失败";
}elseif(is_array($res)){
echo'<imgsrc="'.$res['big'].'"style="margin:10px;">';
echo'<imgsrc="'.$res['small'].'"style="margin:10px;">';
}elseif(is_string($res)){
echo'<imgsrc="'.$res.'">';
}
}elseif(isset($_GET['act'])&&$_GET['act']=="upload"){

$path=$images->move_uploaded();
$images->thumb($path,false,0); //文件比规定的尺寸大则生成缩略图,小则保持原样
if($path==false){
$images->get_errMsg();
}else{
echo"上传成功!<ahref='".$path."'target='_blank'>查看</a>";
}
}else{
?>
<!DOCTYPEHTMLPUBLIC"-//W3C//DTDHTML4.01Transitional//EN""http://www.w3.org/TR/html4/loose.dtd";>
<html>
<head>
<metaname="Author"content="SeekEver">
<metaname="Keywords"content="">
<metaname="Description"content="">
<metacontent="text/html;charset=UTF-8"http-equiv="Content-Type">
<scriptsrc="./js/jquery.min.js"type="text/javascript"></script>
<scriptsrc="./js/jquery.Jcrop.js"type="text/javascript"></script>
<linkrel="stylesheet"href="./css/jquery.Jcrop.css"type="text/css"/>
<scripttype="text/javascript">

jQuery(function($){

//Createvariables(inthisscope)toholdtheAPIandimagesize
varjcrop_api,boundx,boundy;

$('#target').Jcrop({
minSize:[48,48],
setSelect:[0,0,190,190],
onChange:updatePreview,
onSelect:updatePreview,
onSelect:updateCoords,
aspectRatio:1
},
function(){
//
varbounds=this.getBounds();
boundx=bounds[0];
boundy=bounds[1];
//StoretheAPIinthejcrop_apivariable
jcrop_api=this;
});
functionupdateCoords(c)
{
$('#x').val(c.x);
$('#y').val(c.y);
$('#w').val(c.w);
$('#h').val(c.h);
};
functioncheckCoords()
{
if(parseInt($('#w').val()))returntrue;
alert('.');
returnfalse;
};
functionupdatePreview(c){
if(parseInt(c.w)>0)
{
varrx=48/c.w; //小头像预览Div的大小
varry=48/c.h;

$('#preview').css({
width:Math.round(rx*boundx)+'px',
height:Math.round(ry*boundy)+'px',
marginLeft:'-'+Math.round(rx*c.x)+'px',
marginTop:'-'+Math.round(ry*c.y)+'px'
});
}
{
varrx=199/c.w; //大头像预览Div的大小
varry=199/c.h;
$('#preview2').css({
width:Math.round(rx*boundx)+'px',
height:Math.round(ry*boundy)+'px',
marginLeft:'-'+Math.round(rx*c.x)+'px',
marginTop:'-'+Math.round(ry*c.y)+'px'
});
}
};
});

</script>
</head>
<body>
<formmethod="post"action="?act=upload"enctype="multipart/form-data">
<inputtype="file"name="file">
<inputtype="submit"value="上传">
</form>
<divstyle="float:left;"><imgid="target"src="0000.jpg" ></div>
<divstyle="width:48px;height:48px;margin:10px;overflow:hidden;float:left;"><img style="float:left;"id="preview"src="0000.jpg"></div>
<divstyle="width:190px;height:195px;margin:10px;overflow:hidden;float:left;"><img style="float:left;"id="preview2"src="0000.jpg"></div>
<formaction="index.php?act=cut"method="post"onsubmit="returncheckCoords();">
<inputtype="hidden"id="x"name="x"/>
<inputtype="hidden"id="y"name="y"/>
<inputtype="hidden"id="w"name="w"/>
<inputtype="hidden"id="h"name="h"/>
<inputtype="submit"value="裁剪"/>
</form>
</body>
</html>
<?php
}
?>

㈦ php 上传头像预览裁剪功能怎么实现 最好有个例子

说下你的信箱,我发给你。

热点内容
app什么情况下找不到服务器 发布:2025-05-12 15:46:25 浏览:714
php跳过if 发布:2025-05-12 15:34:29 浏览:467
不定时算法 发布:2025-05-12 15:30:16 浏览:131
c语言延时1ms程序 发布:2025-05-12 15:01:30 浏览:166
动物园灵长类动物配置什么植物 发布:2025-05-12 14:49:59 浏览:736
wifi密码设置什么好 发布:2025-05-12 14:49:17 浏览:148
三位数乘两位数速算法 发布:2025-05-12 13:05:48 浏览:399
暴风影音缓存在哪里 发布:2025-05-12 12:42:03 浏览:544
access数据库exe 发布:2025-05-12 12:39:04 浏览:632
五开的配置是什么 发布:2025-05-12 12:36:37 浏览:365