Stanley Ngumo
Stanley Ngumo

Reputation: 4249

Inserting and Displaying images within the TinyMCE content editor in PHP site

I am currently using tinyMCE to edit content within my site and I am looking for a way display an image within the tinyMCE once it has been uploaded to the site.

Note: I am not looking for a means to upload an image directly into tinyMCE. I am looking for the tinyMCE command which would allow me to display an image within the content in the editor after I have uploaded it.

Thanks

Upvotes: 6

Views: 3999

Answers (2)

Arafat Rahman PAppu
Arafat Rahman PAppu

Reputation: 181

After successfull uploaded you have the source of the image (img_src). Now you need to add it to the editor like this

tinymce.activeEditor.insertContent('<img alt="photo" src="' + img_src + '"/>');

Upvotes: 0

Thariama
Thariama

Reputation: 50840

You could insert a regular img-tag inside tinymce using a custom plugin or using the setup parameter in your tinymce init. The src should refer to the html location of the image to be uploaded. As soon as the image is available the image will become visible on next reload of the editors content. If you need further assistance feel free to ask.

Upvotes: 4

Related Questions