Inline images in Drupal with WYSIWYG API, TinyMCE and IMCE

28 +
k4ml's picture

Yeah, it works. I'm using

Yeah, it works. I'm using this approach too in my websites. Except that when you want to add the image, it result in 2 popup windows. Be prepare to answer this when use ask ;)

So far I haven't seen yet any tinymce + filebrowser integration that feel 'seamless' (except Wordpress). Everyone seem to use the default tinymce image popup and then attach some button to open up another popup for file browser. I'm not sure how hard it is to create custom tinymce button that will directly open a popup for filebrowser.

Ivan's picture

Hey. Thanks for the

Hey. Thanks for the tutorial. 

I've found myself moving from FCKeditor module + builtin file browser to the WYSIWYG Api + IMCE + bridge and I agree that it works really well.

himerus's picture

It is a decent option for sure

Thanks for the comments!

Again, my real reason for posting this was that the question was posed to me on how to set this up using these modules, and it is something that I've done over and over both on my own site(s) and others as well. The definite issue is usability of this system to the person creating nodes and inserting images with those 2 popups.

It would be nice to see a modification of IMCE that added a direct popup to the file browser, and would then directly insert the appropriate code into the editor.

Jake Strawn
Drupal Rockstar

alex overton's picture

Thanks :-)

Great tutorial , Thanks for taking the time . Clear instructions very informative wow ! Confirmed my thoughts and I had forgotten about the IMCE bridge . CHEERS !!

 

Have a nice day !

Alex

Anonymous's picture

Thank you

This was very informative. Thanks for the posting.

whatdoesitwant's picture

ïmce

Nice vid. If, like me you really dislike imce's interface, you can use filefield_sources as a sort of overlay.

Ayman's picture

Excellent .. but a feature missing?

Excellent and really helpful, thank you!


But I was hoping to see the option of adding a "description" for each uploaded file. Then a way for this description to appear under the image (just like image assist does). Have you encountered any such requirement, or know of a proper solution (modules) for it?


Thanks!

Jrose's picture

Might have missed something.

First off, Let me say thank you. I have been looking for a simple solution to adding inline images.  I admit I am a newbie to Drupal.

I have setup everything up following your video that you have put together. I did note that you didn't go over everything that was in your blog post, which you stated in the clip. I did skip over the Configuring IMCE per user roles because right now the site is just for me and using it to learn Drupal. Everything appears to be working except...

After I click save when creating the new content I do not see the image on the newly created page.  Everything works up to that point.

My setup is:

Drupal 6.10 - default settings

Modules:

WYSIWYG

IMCE

WYSIWYG IMCE Bridge

TinyMCE placed into the following location: /sites/all/libraries

Any guidance here would be much appreciated.

Regards,

Joe

 

himerus's picture

It's the input filter

You've got a easy issue to solve. :)

It wasn't mentioned in the post or the video, and should have been.

By default, the two input filters that ship with Drupal are Filtered HTML and Full HTML. Filtered HTML filters out many things and only allows a bare set of tags to be used. Oddly enough, the IMG tag is NOT set up in that filter.

You can do 1 of 2 things to easily solve this. Either change the input type to Full HTML on those posts, OR the more appropriate fix for me personally is going into the settings for the Filtered HTML input filter, and adding <img> to the allowed tags list.

Jake Strawn
Drupal Rockstar

Kelly's picture

Hey this page really

Hey this page really informative and interesting. I tried to do the same thing that jrose did, but I can't get iline images. I have added <img> to my filter html (under input formats). But still no luck. I have got inline images to work by other methods, I would much rather use this one though. I don't know if that is enough info for you to try to do anything, but if you have any ideas, I would love to hear them.

Joanne's picture

Image Links

might not be the best place to post this comment, but just bumped into your blog. been searching everywhere in how to put images in the footer & block regions. sounds simple? i'm having an extremely hard time.

i downloaded theme_image & linkimagefield. have no idea if that's what i need.

i also tried this:

<?php $image = 'myfile.jpg';header('Content-type: image/jpeg') ;$source = imagecreatefromjpeg($image) ;?>

JRose's picture

Worked

Adding the tag to the filtered HTML tag list worked.

Thank you,

You wouldn't happen to have a guide on adding a gallery would ya?

hixster's picture

Thanks great tutorial

Hey Jake,

Thanks for taking the time to post this great tutorial. I am always looking at ways to make image uploads easier, especially for my clients. I have been using the FCKEditor & ImgAssist modules for a while, but will probably switch to this method as it's seems way less clunky.

Just out of interest, which theme are you using for you admin pages and admin menu, it looks pretty clean.

 

Thanks again!

himerus's picture

The admin module/theme

For this tutorial, and still on my own site, I have the Admin module (http://drupal.org/project/admin) The version 1 of that module provided both the functionality, and the admin theme.

Since then, it has changed a bit, and the 2nd version of the Admin module only provides a sidebar or top region method of getting to the places you want to go, and reorganizing the IA of the sections in the administrative section. The new version doesn't provide a theme, but I now use the Rubik theme provided by Development Seed. (http://code.developmentseed.org)

The combination of those give a great interface for D6 sites, and every client I've pushed those off on have loved the interface.

Jake Strawn
Drupal Rockstar

girish's picture

Hey, Thanks a lot for the

Hey, Thanks a lot for the tutorial. As it is i'm a newbie to drupal and found this tutorial helpful.

initially i had tried fck editor with wysiwyg without much success, but your tutorials helped me set tinymce properly.

But there seems to be a problem. When i insert an image or try to embed a video it appears in the editor box but when i try to preview or save, it gets replaced by html code with the address.

As you have earlier recomended i added <img> tag to filtered html and also used full html type. But it dint change anything. I dont get whats wrong with it.

Anyways thanks again!

Automatic Athlete's picture

Finally!!! A tutorial that works!

Just wanted to say thanks so much for you insight!!! I have scoured the internet for some explanation of inserting inline images in Drupal and you have helped me with your solution!!!


Great work and thanks again!!!


The Automatic Athlete

Anonymous's picture

Alternative

There is also a alternative way with http://drupal.org/project/wysiwyg_imageupload

It integrates with all editory in the WYSIWYG  module (using its api) and is there cross editor compatible. It aims to be very easy and utiliazes imagecache.

You can look at this http://www.youtube.com/watch?v=LEKpvI1G8qE videocast to see it in action

UKC's picture

Great work!

Thanks alot for a wonderful tutorial. I am also a newbie to drupal and your tutorial really helps me.

Neil's picture

You saved my hair - I was

You saved my hair - I was pulling most of it out.  Thanks - great quality video and good information.  This can be a sticky subject!

himerus's picture

Glad it helped!

Glad to hear it helped ya out! This is one of those things that I've had to do a million times and finally decided to document it well... I need to spend some time doing other videos/posts like this on some standard topics.

Thanks for the feedback!

Jake Strawn
Drupal Rockstar

Brian French's picture

Anonymour User IMCE access

Hi there, your Nov 2009 post is still getting traction!  Helped me out in a pinch and I appreciate it, was able to quickly get everything working but have encountered one concern; anonymous user access.

I'd hoped to be able to grant IMCE access to only authenticated users, while forcing anonymous users to use TinyMCE (via the WYSIWYG module) without IMCE capability.  Bottom line is I want to allow authenticated users to upload images while anonymous users can do only text.  But every configuration I've tried seems to grant access to anonymous users (though anonymous users are unable to see the directory structure for images already uploaded).  Thoughts?

Anonymous's picture

thank you so much

Oh my gawd... too many ways to do this but yours is definitely the simplest. Thank you so much for the awesome tutorial - very clear!

Ryan A Neily's picture

inline image enabling

After much research and not quite successful efforts to find one of those "many ways in Drupal to exhibit images inline with content in Drupal"  that actually work, The above directions by Jack Strawn worked for me in Drupal6. Many thanks. Ryan

hixster's picture

Rubik & TinyMCE

Slightly off topic, but do you experience and issues using the Rubik theme with TinyMCE+WYSIWYG?

I find copying a pasting seems to add Rubik markup to the copy and a lot the formatting fuctions for lists don't work for previews in filtered HTML mode...

 

Just curious?

Djigo's picture

Problem saving page

Hi,first excuse me for the quality of my english,i am in a french speaking country.

I followed instructions so i can create page or articles with the rich editor but when i save the page i have this for example :[size= medium][color=#008000]xfgsfhgsh  [/color][/size][color=#ffff00]djgcbjcn [/color][color=#ff0000]vbjkhfjxdhdxh[/color]

I don't know what's the proble,when i chose or a size the text is replaced after saving by [size= medium][color=#008000].

I know that it will be difficult for you to understand what i mean but i hope that you'll help me to solve my problem.

thank you.

Water Filters Specialist's picture

Drupal's flexibility

Is Drupal flexible enough to handle an online e-commerce website with 1K+ pages?


 

Yukti Khanna's picture

Coool it is

Too goooood :) ... Love the plugin .. great help .. million thanks .. !!!

 

Was stugling for one such from last 4 days .. Simply loved it ..

 

million thanks !!

Yukti

flat iron buff's picture

What about php Tags?

Can you add PHP code or DB connection into tags? <code> does that support all php functions?

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <p> <h2> <h3> <h4> <h5> <h6> <img> <p>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Twitter-style @usersnames are linked to their Twitter account pages.

More information about formatting options