Ho provato a scrivere il programma ma mi viene dato un errore:
ovvero, file_get_contents($NewImg) vuole una stringa.
questo è il codice:
Codice PHP:function upImg($File, $Size, $Op){
if($Size > 2000000){
throw new Exception("Massimo 2MB");
}
list($Width, $Height, $Ext) = getimagesize($File);
if($Ext != 1 && $Ext != 2 && $Ext != 3){
throw new Exception("Formato supportato JPG, GIF e PNG");
}
if($Ext == 2) $ImgUp = @imagecreatefromjpeg($File);
elseif($Ext == 1) $ImgUp = @imagecreatefromgif($File);
elseif($Ext == 3) $ImgUp = @imagecreatefrompng($File);
$NewImg = imagecreatetruecolor(32, 32);
imagecopyresized($NewImg, $ImgUp, 0, 0, 0, 0, 32, 32, $Width, $Height);
$NewImg = file_get_contents($NewImg);
$Image = addslashes($NewImg);
$Query = "UPDATE Users_Info INNER JOIN Users_Auth ON Users_Info.ID = Users_Auth.ID SET Users_Info.Avatar = '$Image' WHERE Users_Auth.NickName = '".$_SESSION["Confirm"]['NickName']."'";
mysql_query($Query, $this->ConnUser)or die("Error!!!!");
}

Rispondi quotando