vue.js - vue rich text editor recommendation and php processing base64
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-27 17:42:33
0
2
936

vue2 rich text editor recommendation and php processing base64
Now I want to use vue2 to make a PC-side article publishing page
You need to use a rich text editor
Front-end images are displayed through base64
etc. After the user actually submits, it will be saved to the server
Now I want to ask you something
1.Does Vue2 have any mature rich text editor? The pictures are displayed using base64
2.php backend receives the rich text content $_POST ['content']How to extract the image, save it and then replace base64 with url?

Is there a more mature solution?

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(2)
世界只因有你

Try VUE-QUILL-EDITOR, link: https://github.com/surmon-chi...

漂亮男人

Just go to the editor part upstairs. . The image base64 was done just two days ago. The front-end display should be no problem. I will post the background program for you below

        //图片处理
        $base_file=APP_PATH.'../public';
        $file='/upload/image/'.date('Ymd',time()).'/';
        //检查是否有该文件夹,如果没有就创建,并给予最高权限
        if(!file_exists($base_file.$file)){
            $rs=mkdir($base_file.$file, 07777,true);
        }
        foreach ($info['images'] as &$val) {
            //匹配文件格式
            if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $val, $result)){
                $type=$result[2];
                if (file_put_contents($base_file.$file.md5($val).'.'.$type, base64_decode(str_replace($result[1], '', $val)))){
                    $val=$file.md5($val).'.'.$type;
                }
            }            
        }

What I uploaded here is an array. If you want to upload a single image, you don’t need to loop, just convert it directly

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!