私は、Creditor、Paperclip、Mailer(送信グリッド)を使用してコンテンツを作成し、それを購読者にメールしています。サーバーに画像をアップロードしていて、ウェブサイトに正しく:content
に表示されますが、ユーザーはメールで空白の画像を受信します。画像がRailsメールに表示されない
これは私のメーラー体である:
<body>
<h3>Hi <%= @listener.name %>, </h3>
<p><h3>You have received a message from <%= @message.speaker.organization %></p></h3><br/>
<!-- <p><%= @message.speaker.fullname %> has sent a message to you.</p><br/> -->
<h3 style="color: #000;">Description: <strong style="font-size: 12px; color: #444;"><%= @message.description %></strong></h3><hr/>
<p style="font-size: 12px;"><%= raw @message.content %></p><br/>
</body>
そして、私のメーラー:債権者
CKEDITOR.editorConfig = function(config) {
//config.language = 'es'; //this could be any language
config.width = '650';
config.height = '500';
config.baseHref = 'http://messagefollower.com';
// Filebrowser routes
// The location of an external file browser, that should be launched when "Browse Server" button is pressed.
config.filebrowserBrowseUrl = "/ckeditor/attachment_files";
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";
// The location of a script that handles file uploads in the Flash dialog.
config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.
config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";
// The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog.
config.filebrowserImageBrowseUrl = "/ckeditor/pictures";
// The location of a script that handles file uploads in the Image dialog.
config.filebrowserImageUploadUrl = "/ckeditor/pictures";
// The location of a script that handles file uploads.
config.filebrowserUploadUrl = "/ckeditor/attachment_files";
// You could delete or reorder any of this elements as you wish
config.toolbar_Menu = [
{ name: 'document', items: ['Source', '-', 'Save'] },
{ name: 'clipboard', items: ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo'] },
{ name: 'editing', items: ['SelectAll', '-', 'SpellChecker', 'Scayt'] },
{ name: 'tools', items: ['Maximize', 'ShowBlocks', '-'] }, '/',
{ name: 'basicstyles', items: ['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat'] },
{ name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
{ name: 'links', items: ['Link', 'Unlink', 'Anchor'] }, '/',
{ name: 'styles', items: ['Styles', 'Format', 'Font', 'FontSize'] },
{ name: 'colors', items: ['TextColor', 'BGColor'] },
{ name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'Smiley', 'SpecialChar', 'PageBreak'] }
];
config.toolbar = 'Menu';
return true;
};
私attachment.rb
class Ckeditor::AttachmentFile < Ckeditor::Asset
has_attached_file :data,
:url => "/ckeditor_assets/attachments/:id/:filename",
:path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"
validates_attachment_presence :data
validates_attachment_size :data, :less_than => 100.megabytes
do_not_validate_attachment_file_type :data
def url_thumb
@url_thumb ||= Ckeditor::Utils.filethumb(filename)
end
end
ため
class MessageMailer < ActionMailer::Base
default from: "[email protected]"
def mail_message_to_listener(message, listener)
@message = message
@listener = listener
if @message.image?
message_image_path = @message.get_image_path
attachments[@message.image_file_name] = File.read(message_image_path)
end
mail(to: @listener.email, subject: "#{@message.title}, Part 1")
end
def mail_message_part_to_listener(messagepart, listener)
@messagepart = messagepart
@listener = listener
message_title = @messagepart.message.title
part_number = @messagepart.part_no
if @messagepart.image?
message_part_image_path = @messagepart.get_image_path
attachments[@messagepart.image_file_name] = File.read(message_part_image_path)
end
mail(to: @listener.email, subject: "#{part_number.ordinalize} part of #{message_title}, Part #{part_number+1}")
end
end
私config.jsの
それは 'message.content'属性にありますか?相対URLを使用します。それをしないように設定する必要があります。あなたは[docs](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-baseHref) –
からそれを設定することができるように見える私はそれを試してみる – Boris
私が参照してください、私は絶対指定私のconfig.jsのURLをconfig.baseHref = 'messagefollower.com/public/ckeditor_assets/pictures/:id/...;; ckeditorのソースとしてはsrc = "/ ckeditor_assets/pictures/10/content_kolom-300-400x400.jpg"と表示されます。 – Boris