Remote image upload is a very interesting thing, such as you copy a file from another site, if the text with a picture, the editor will automatically extract the picture, upload, so do not worry about the remote image after the failure of their own local can not browse.
Through the check, found the remote image upload Operation page is: getremoteimage.php. After opening we first configure Savepath, because different users, need to store to a different directory, so as to avoid confusion, but also easy to manage
Modified code:
Copy CodeThe code is as follows:
Remote Capture picture Configuration
if (isset ($_session[' admin ')) {
$myPath = ' http://www.jb51.net/../dofiles/ueditorUpload/admin/'. $_session[' admin ' [' id ']. ' /';
}else if (isset ($_session[' user ')) {
$myPath = ' http://www.jb51.net/../dofiles/ueditorUpload/user/'. $_session[' user ' [' id ']. ' /';
}else{
$myPath = ' http://www.jb51.net/../dofiles/ueditorUpload/unkonw/';
}
$config = Array (
"Savepath" = $myPath,//save path
"Allowfiles" = = Array (". gif", ". png", ". jpg", ". jpeg", ". bmp"),//file allowed format
"MaxSize" = 3000//File size limit, in kilobytes
);
Then the problem came, ueditor, files, pictures uploaded by Uploader.class.php this PHP class operation, but the remote image upload is not.
I found in line 85 that when I created the path, I simply used mkdir to create it, because mkdir cannot create a path with a hierarchy, so copying a remote picture upload fails if the path does not exist.
Knowing the problem is easy to deal with, I'll start by writing a function that loops through the creation of a file directory (because it was written before, it's used directly here):
Copy CodeThe code is as follows:
Create a folder with hierarchies consecutively
function Recursive_mkdir ($folder) {
$folder = Preg_split ("/[\\\\\/]/", $folder);
$mkfolder = ";
for ($i =0; Isset ($folder [$i]); $i + +) {
if (!strlen (Trim ($folder [$i])) {
Continue
}
$mkfolder. = $folder [$i];
if (!is_dir ($mkfolder)) {
mkdir ("$mkfolder", 0777);
}
$mkfolder. = Directory_separator;
}
}
Then modify the 85 lines:
Copy CodeThe code is as follows:
Create a Save location
$savePath = $config [' Savepath '];
if (!file_exists ($savePath)) {
Recursive_mkdir ($savePath);
mkdir ("$savePath", 0777);
}
In this way, there is no problem.
This issue has also been submitted to the official Baidu, hoping to amend.
Test Ueditor version 1.2.3.0, if the previous version also has related problems, according to modify the idea to modify should also be resolved.
http://www.bkjia.com/PHPjc/325896.html www.bkjia.com true http://www.bkjia.com/PHPjc/325896.html techarticle remote image Upload is a very interesting thing, such as you copy a file from another site, if the text with a picture, the editor will automatically extract the image, upload, from ...