2016-03-28 20:21
浏览 970

Tinymce imagetools图像没有显示

so I started using tinymce for my blog posts and there is this problem with imagetools, they work while images are being edited, but after the article is posted, only this BIG url is showing. I think the problem is that, the blob image which is created while editing is not saved and I need to save it, right?

By the way I am using laravel.

图片转代码服务由CSDN问答提供 功能建议

所以我开始在我的博客文章中使用tinymce,而imagetools存在这个问题,它们在编辑图像时起作用 ,但在发布文章后,只显示了这个大网址。 我认为问题在于,编辑时创建的blob图像没有保存,我需要保存它,对吗?


  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • dquoj04882 2016-03-28 20:34

    When you edit images using the image tools they will always be turned into a Base64 or BLOB encoded image - the image tools function in the browser and know nothing (directly) of the application in use (e.g. Laravel). As such its up to the application to determine what to do with these images:

    The basic process is that TinyMCE will create a separate HTTP POST for each image that you modify with the image editor. It will send that image to a URL of your choosing (via HTTP POST) based on the setting of the images_upload_url option in your init.

    The image handler at the URL referenced in the images_upload_url (which you have to create) has to do whatever needs to be done to "store" the image in your application. That could mean something like:

    • Store the item in a folder on your web server
    • Store the item in a database
    • Store the item in an asset management system

    I would assume Laravel has some APIs such as the Filesystem API that you could use to store the images appropriately.

    Regardless of where you choose to store the image your image handler needs to return a single line of JSON telling TinyMCE the new location of the image. As referenced in the TinyMCE documentation this might look like:

    { location : '/uploaded/image/path/image.png' }

    TinyMCE will then update the image's src attribute to the value you return. If you use the images_upload_base_path setting in the init that will be prepended to the returned location.

    The net here is that TinyMCE knows when an embedded image exists in your content but it can't possibly know what to do with that image in the context of your application so that job (the "image handler") is something you must create.

    解决 无用
    打赏 举报

相关推荐 更多相似问题