CKEditor不改变图像的大小
CKEditor not changing size of image
我已将 CKEditor 安装到我的 rails 应用程序中。在编辑器中,当我在浏览服务器后选择图像时,我尝试使用给定的 height
和 width
选项更改图像的大小。
展示页面显示服务器图片时,是我最初下载时的原始图片大小。
show.html.erb
<h1>Blog Show Page</h1>
<h3><%= @blog.title %></h3>
<br>
<%= simple_format(@blog.body) %>
<br>
Keyword: <%= @blog.keyword %>
<br>
<br>
Published on: <%= unsanitize_date(@blog.publish_date.to_s) %>
<br>
谁能解释一下为什么编辑器不允许调整图像大小?
提前致谢!
因为当你这样做时,CKEditor 只需将 style
属性添加到 <img/>
标签。图像大小调整是在服务器上完成的,而不是在客户端。如果你想做,在CkeditorPictureUploader
class中定义多个版本即可。参见 ckeditor gem。
问题出在 simple_format
。替换为 raw
,现在图像大小应该可以工作了。
我已将 CKEditor 安装到我的 rails 应用程序中。在编辑器中,当我在浏览服务器后选择图像时,我尝试使用给定的 height
和 width
选项更改图像的大小。
展示页面显示服务器图片时,是我最初下载时的原始图片大小。
show.html.erb
<h1>Blog Show Page</h1>
<h3><%= @blog.title %></h3>
<br>
<%= simple_format(@blog.body) %>
<br>
Keyword: <%= @blog.keyword %>
<br>
<br>
Published on: <%= unsanitize_date(@blog.publish_date.to_s) %>
<br>
谁能解释一下为什么编辑器不允许调整图像大小?
提前致谢!
因为当你这样做时,CKEditor 只需将 style
属性添加到 <img/>
标签。图像大小调整是在服务器上完成的,而不是在客户端。如果你想做,在CkeditorPictureUploader
class中定义多个版本即可。参见 ckeditor gem。
问题出在 simple_format
。替换为 raw
,现在图像大小应该可以工作了。