Browse files

Fixing images in the WYSIWYG editor.

This is sort of a hack, but since we are not parsing full tags in the WYSIWYG editor (in fact, all tags are currently converted to html characters by default), we are just replacing the converted string that we know will be present for images. Fixes #1545.
  • Loading branch information...
1 parent 0feb290 commit 74666ddbf598c6ce794ce302c7ce866f1e61c539 @adamfairholm adamfairholm committed Jul 9, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 system/cms/modules/streams_core/field_types/wysiwyg/field.wysiwyg.php
16 system/cms/modules/streams_core/field_types/wysiwyg/field.wysiwyg.php
@@ -46,6 +46,22 @@ public function event()
// --------------------------------------------------------------------------
+ * Pre-Ouput WYSUWYG content
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+ public function pre_output($input)
+ {
+ // No matter what, we are going to replace {{ url:site }} with it's
+ // rightful value.
+ return str_replace('{{ url:site }}', site_url().'/', $input);
+ }
+ // --------------------------------------------------------------------------
+ /**
* Output form input
* @param array

3 comments on commit 74666dd

PyroCMS member

The WYSIWYG editor parses {{ url:site }} tags via javascript in Pages and everywhere else. I wonder what's different about this? Is it possible that there was another problem that kept the thumbnail from being displayed?

The problem that I see with this method is that the url will then get saved to the database so if they migrate to a different domain their images will be broken. Unless I'm not understanding correctly


It is not saved in the db. This is the pre_output hook that is called before output of the field content.


I still have this issue with version 2.2.0-rc1

The src is even surrounded with p-tags


Please sign in to comment.