CKEditor图像不工作 [英] CKEditor images not working

查看:141
本文介绍了CKEditor图像不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对CKEditor有些麻烦。

I'm having some trouble with CKEditor.

我为我的网站创建了一个博客,并在后端部分写了新帖子并批准了评论等。所有工作正常,我使用CKEditor编写和编辑帖子。

I have created a blog for my website and a back end section to write new posts and approve comments etc. It's all working fine and I use CKEditor to write and edit posts.

当写入文本只是后罚款,它被存储在数据库,随后出现在网站上这应该。但如果我写一个图像在其中的一个帖子它不会存储在数据库。所有文字和图片都会消失。

When writing a text only post its fine, it gets stored in the database and subsequently appears on the website as it should. But If I write a post with an image in it it doesnt get stored in the database. All text and images disappear.

帖子的标题进入数据库,因为这只是使用正常的文本框。

The title of the post goes into the database as this is just using a normal text box. But everything in the CKEditor disappears if I put an image in there.

这里有一些截图:


我按图像按钮并输入存储在我的服务器上的图像的显式URL。 ( http://www.mydomain.com/images/image.jpg


当我按下ok时,图像在CKEditor中以上方的文本显示。

When I press ok the image is visible in CKEditor with the text above it.


当我提交帖子,然后返回查看或编辑它,CKEditor是空的,只有标题是存在的。检查数据库我可以看到标题输入,但身体isnt。

When I submit the post and then return to it to view or edit it, the CKEditor is empty and only the Title is there. Checking the database I can see the title is entered but the body isnt.

如果我不输入图像一切正常的标题和身体进入数据库和博客帖子

If I dont enter an image everything works fine title and body go into the database and the blog post appears on the site.

推荐答案

有没有人知道这里有什么问题? >

我实际上自己发现了答案。

I actually discovered the answer myself

在CKEditor中创建的图片标签应该像

The image tags created in the CKEditor would be something like

<img src="images/picture.jpg">

并且我的SQL查询将类似于

and my SQL query would be something like

$query = "INSERT INTO Table (blog_body, blog_title) VALUES ('".$blogBody."','".$blogTitle."')";

或沿着这些行。

为了解决它,我只是换了引号。将查询放在单引号中,并交换有关变量的引号。

To solve it I just swapped the quotation marks around. Placing the query in single quotes and swapping the quotes about the variables around.

这解决了我的问题。

只要想想如果别人有这个麻烦,这可能有助于

Just thought if someone else is having this trouble this may help

这篇关于CKEditor图像不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆