Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

tinymce

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

like image 208
Stanley Ngumo Avatar asked Apr 28 '11 07:04

Stanley Ngumo


People also ask

Where are TinyMCE images?

Images are sent to the Image Uploader via HTTP POST with each post containing a single image. The image handler at the URL referenced in the images_upload_url must “store” the image in the application. Some examples include: Store the item in a folder on the web server.

How do you get content on TinyMCE?

The TinyMCE getContent and setContent methods You can do this using the getContent() API method. Let's say you have initialized the editor on a textarea with id=”myTextarea”. This will return the content in the editor marked up as HTML.


1 Answers

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.

like image 62
Thariama Avatar answered Oct 20 '22 05:10

Thariama