我正在创建一个网站,我需要所有用户都有一个方形的个人资料图片。任何人都可以指向一个网站,解释使用PHP裁剪图像/调整大小图像的过程吗?
答案 0 :(得分:1)
答案 1 :(得分:0)
首先,您可以使用var Line = function()
{
this.unit = ko.observable();
this.convertFactor = ko.observable();
}
var Measurement = function(line)
{
this.msrmntValue = ko.computed(function(){
var a = 20*line.convertFactor();
document.getElementById("output").innerHTML += "\nValue set to " + a;
return a;
});
}
var line = new Line();
line.convertFactor(20);
var msrmnt1 = new Measurement(line);
var msrmnt2 = new Measurement(line);
// Display the value
function SetValue()
{
line.convertFactor(40);
};
function NullifyAndSetValue()
{
msrmnt1 = null;
msrmnt2 = null;
// After the ibjects have been nullified I want that the computed properties should not be recalculated
// and the objects should be garbage collected, but looks like the objects are left in memory indefinitely
// because knockout is still referenceing them.
line.convertFactor(80);
}
获取该图片的宽度和高度
并使用getimagesize()
创建一个图像字符串
并为您的个人资料图片创建一个您需要的宽度和高度的来源
并使用file_get_contents()
创建$ tmp
最后,您为个人资料imagecreatetrueclor()
创建了一个图片
下一步你应该用imagejpg()