image facilities in tinycme

9 posts by 2 authors in: Forums > CMS Builder
Last Post: February 8, 2019   (RSS)

By willydoit - January 31, 2019

Hi all,

I have an issue with the wysiwyg element in that when in the latest cmsb and the new tinymce an image is uploaded and inserted there isnt any facility to apply any padding, or if there is I cannot see it. I understand that plugins can be added but whenever i try it just breaks the toolbar.  Is anyone able to provide the exact syntax and instructions  on how to add the extra image editing features please.

Thanks in advance for any help provided.

By daniel - February 4, 2019

Hi Willydoit,

Are you trying to enable the TinyMCE Image Tools plugin? (https://www.tiny.cloud/docs/plugins/imagetools/)

To do this, find the line in the TinyMCE config that starts with "plugins:" and add "imagetools" to this list, which would then look something like this:

plugins: "table,fullscreen,paste,media,lists,charmap,textcolor,link,anchor,hr,paste,image,code,codesample,imagetools",

This plugin doesn't require editing the "toolbar" settings; the controls should automatically appear when you click on images within the editor.

Hope this helps, let me know if you have any other questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

By willydoit - February 5, 2019

Hi Daniel,

thanks for that, I have added the tool but it still doesn't provide the facility to add padding to the image to prevent text butting right up to the edge of the image.  Could you advise how we achieve this facility?  I would have thought would be a pretty basic requirement when adding an image so I must be missing something obvious here.

Thanks again

Steve

By daniel - February 5, 2019

Hi Steve,

If you want to add padding to an inline image in the editor, a good option for you to look at is the style selector that can be configured for TinyMCE. This can let you apply custom classes or styles to specific elements - such as images. Dave wrote up some instructions on how to enable this here: https://www.interactivetools.com/forum/forum-posts.php?postNum=2242695#post2242695

Let me know if that works for you!

Thanks,

Daniel
Technical Lead
interactivetools.com

By willydoit - February 7, 2019

Hi Daniel,

In theory that will be a way to solve the spacing issue however I also need images to be responsive, using bootstrap I can manually add code class="img-responsive" which solves that issue but I cannot expect clients to edit the code and enter this.  I have tried various ways to add this code into the wysiwyg_custom.php code below but it just breaks the file and the toolbar doesnt load.  Is there any way to have class="image-responsive automatically applied to any/all images.

{ title: 'Image Left',    selector: 'img', styles: {'float': 'left','margin': '0 10px 0 10px'} },

Given that websites these days have to be responsive and that bootstrap is so widely used in website design I am sure there must be a simple solution to this

Thanks again for your help.

Steve

By willydoit - February 7, 2019 - edited: February 7, 2019

Hi Daniel,

The code I provided works fine, it broke when i tried to add the class= "img-responsive" to it which is a built in element in bootstrap. I will try the css you provided, could it be added to the wysiwyg coding above?

Steve

By daniel - February 7, 2019

Hi Steve,

Sorry, I had misunderstood. If you want to also add the "img-responsive" class to the style, you can combine it with the styles like this:

{ title: 'Image Left', selector: 'img', classes: 'img-responsive', styles: {'float': 'left','margin': '0 10px 0 10px'} },

Or, if you'd like to have a separate format for the responsive class, this should work:

{ title: 'Image Responsive', selector: 'img', classes: 'img-responsive' },

It would also work to simply add those responsive styles directly into the "styles" section, though I find using the class creates a bit "neater" result.

Let me know if that does the trick!

Thanks,

Daniel
Technical Lead
interactivetools.com

By willydoit - February 8, 2019

Thanks Daniel,

that worked a treat, I can only think that I had my syntax wrong somewhere, now I have a working version I should be able to build on that for other items.

Thanks again for your help.

Steve