0
업로드 된 이미지를 표시하려고하는데이 코드를 사용하여 처리 된 후 URL이지만 "완료 ..."로 반환되는 페이지 대신이 작업을 수행하는 방법에 조금 얽혀 있습니다.PHP 업로드 후 결과 이미지를 어떻게 표시합니까?
http://llngg6czd-site.1tempurl.com/tester/index.php
Index.php는
<!DOCTYPE html>
<html>
<head>
<title>Upload Files using normal form and PHP</title>
</head>
<body>
<form enctype="multipart/form-data" method="post" action="upload_image.php">
<div class="row">
<label for="image">Select a File to Upload</label><br />
<input type="file" name="image" />
</div>
<div class="row">
<input type="submit" value="Upload" />
</div>
</form>
</body>
</html>
image_upload.php
<?php
require_once('ImageManipulator.php');
if ($_FILES['image']['error'] > 0) {
echo "Error: " . $_FILES['image']['error'] . "<br />";
} else {
// array of valid extensions
$validExtensions = array('.jpg', '.jpeg', '.gif', '.png');
// get extension of the uploaded file
$fileExtension = strrchr($_FILES['image']['name'], ".");
// check if file Extension is on the list of allowed ones
if (in_array($fileExtension, $validExtensions)) {
$newNamePrefix = time() . '_';
$manipulator = new ImageManipulator($_FILES['image']['tmp_name']);
// resizing to 200x200
$newImage = $manipulator->resample(200, 200);
// saving file to uploads folder
$manipulator->save('uploads/' . $newNamePrefix . $_FILES['image']['name']);
echo 'Done ...';
} else {
echo 'You must upload an image...';
}
}
Imagemanipulator.php
https://gist.github.com/philBrown/880506
어떤 도움을 주시면 감사하겠습니다.