1
。我有以下代碼將圖像上傳到服務器目錄,我想要做的是在上傳之前調整圖像大小。這可能嗎?任何幫助都感激不盡。提前致謝!在上傳到目錄之前調整圖像大小
if ((($image["type"] == "image/gif")
|| ($image["type"] == "image/jpeg")
|| ($image["type"] == "image/pjpeg")
||($image["type"] == "image/png")))
{
if ($image["error"] > 0)
{
echo "Return Code: " . $image["error"] . "<br />";
}
else
{
echo $studentno;
echo "Upload: " . $image["name"] . "<br />";
echo "Type: " . $image["type"] . "<br />";
echo "Size: " . ($image["size"]/1024) . " Kb<br />";
echo "Temp file: " . $image["tmp_name"] . "<br />";
$newname = time().$image["name"];
move_uploaded_file($image["tmp_name"],"$dir" . $newname);
echo "Stored in: " . "$dir" . $newname;
else
{
echo '<form method="post" id="display" action="Edit.php">';
echo '<input type="button" VALUE="Error" onClick="alert(Welcome to the Groan Zone!)">';
echo '</form>';
}