0
nicEditor for textarea에 관한 문제가 있습니다.NicEdit 그림이 업로드되었지만 편집기에서 빈 이미지를 표시합니다.
로컬 저장소 이미지에서 이미지를 업로드하면 폴더 및 데이터베이스에도 업로드되지만 텍스트 영역에는 표시되지 않습니다.
이미지에서 볼 수있는 것처럼 텍스트 편집기는 빈 이미지를 표시합니다. 내 코드는 다음과 같습니다. 성공적으로 폴더 및 데이터베이스에 업로드됩니다
<?php
//Check if we are getting the image
if(isset($_FILES['image'])){
//Get the image array of details
$img = $_FILES['image'];
//The new path of the uploaded image, rand is just used for the sake of it
$path = "upload/" . rand().$img["name"];
//Move the file to our new path
move_uploaded_file($img['tmp_name'],$path);
//Get image info, reuiqred to biuld the JSON object
$data = getimagesize($path);
//The direct link to the uploaded image, this might varyu depending on your script location
$link = "http://$_SERVER[HTTP_HOST]"."/nicedit/".$path;
//Here we are constructing the JSON Object
$res = array("data" => array("link" => $link, "width" => $data[0], "height" => $data[1]));
//echo out the response :)
echo json_encode($res);
}
?>
이미지를 따를 때
var nicUploadOptions = {
buttons : {
'upload' : {name : 'Upload Image', type : 'nicUploadButton'}
}
};
var nicUploadButton=nicEditorAdvancedButton.extend({nicURI:"image.php" and more..
nicEditors.registerPlugin(nicPlugin,nicUploadOptions);
그리고 PHP 코드입니다.
콘솔을 확인하거나 img를 검사하여 반환되는 항목을 확인하십시오. –