froala / yii2-froala-editor

Yii 2 widget for the Froala WYSIWYG HTML Editor.

Home Page:https://froala.com/wysiwyg-editor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong link in response

bit-prophet opened this issue · comments

Hi
I use this code to upload image:

$path = Url::to(['/up/images/']);
$response = \FroalaEditor_Image::upload($path);

but the response is like this:
"up/images45052b51c36d755734c6af3b83a9e446d78acbd8.jpg"
Actually the last / for dir is removed.
This problem exists for every action(upload file, manage, delete).

So I changed getList function in Image.php to this(just added DIRECTORY_SEPARATOR):

if (in_array(mime_content_type($absoluteFolderPath . DIRECTORY_SEPARATOR . $name), $image_types)) {
    // Build the image.
    $img = new \StdClass;
    $img->url = $folderPath . DIRECTORY_SEPARATOR . $name;
    $img->thumb = $thumbPath . DIRECTORY_SEPARATOR . $name;
    $img->name = $name;

    // Add to the array of image.
    array_push($response, $img);
}

Do you have this problem or it's my fault?

Thank you, you can reference yii2 guider file upload for upload image
Guider upload file

and folow topic for more info Upload image
and you code is Froala upload, not of yii

Thank you too, but I know the way of Yii2 upload.
I just want to report this froala php sdk uploading issue.

yes, @stefanneculai will support