Reputation: 21
Hi i am new to tinymce, I am using tinymce 3.3.6 version.
I am trying to insert an image into tinymce editor with mceinsertCommand
...
e.g.
tinyMCE.execCommand("mceInsertContent", false, html_image_tag);
In above command, html_image_tag is html img tag with image src address pointing to any image in a folder in jboss/bin
directory...consider i have MY_Folder in jboss/bin
directory ...and i want paste images from this folder into tinymce textarea...
And "My_Folder" is a folder in jboss/bin
directory ...now my problem is..even if i give path like above correctly...its not inserting image into tinymce...
if i give some image path from internet like ...http://images.nationalgeographic.com/wpf/media-live/photos/000/036/cache/grizzly-bear-cubs_3600_990x742.jpg
it inserts image correctly..but in order to access an image on my machine..its not working...
it gives like broken img ..i.e. maybe its not getting image location properly...
i tried it in so many ways...with different src path configurations..in img tag..as shown above....but its not working..
So any/hint/help/comments are appriciated..hank you in advance.
Upvotes: 1
Views: 9563
Reputation: 11
One thing yo have in mind is that maybe you need to specify the valid elements to be added to the container.
TinyMCE has a property in the init function called valid_elements which you can use to specify just those elements that you want. I faced the same issue and this is what I did.
TinyMCE valid_elements web page
Upvotes: 1
Reputation: 330
start your image url with a /
so /subfolder/filename.jpg
the path to your image needs to be either relative to the page including it, or an absolute path
--- edit ---
i think the problem might be that its not resolving your external dns name to your localhost? maybe what you need to do is edit your hosts file on your dev machine and alias your local host with your external dns, then use the fully qualified external dns path to your images... maybe..
goto: C:\WINDOWS\system32\drivers\etc (assuming windows here) and open the 'hosts' file in an editor. then add the following line, replacing the relevant bits:
127.0.0.1 www.yourDomainName.com
save the file, reboot the machine and change your path references to use the full url - not sure if im barking up the wrong tree here - if i am i think i need a bit more information about your setup!
hope this helps
Upvotes: 1