prestoav

'Skip width attributes on image tags' not working?

Recommended Posts

Hi all,

PW: 3.0.42

I'm trying to have responsive images in the body field. First I need to stop the image tag generated by CKEditor adding the width attribute to the image tag on insertion. I found the 'Skip width attributes on image tags?' in the settings of ProcessPageEditImage and that suggests it does exactly what I'm after.

Sadly, even when this checkbox is checked and a new image is inserted the width attribute is still added.

Am I missing something?

TIA.

Screenshot 2017-09-25 14.35.04.png

Share this post


Link to post
Share on other sites

It applies to images added after the setting is changed. 

Share this post


Link to post
Share on other sites

Hi Abdus,

Actually I assumed that so, when testing, I removed the image from the page completely and added an all new one. Same result, the width attribute still keeps being added.

 

  • Like 1

Share this post


Link to post
Share on other sites

Hmm. I am having the same issue. 

I did some debugging. It looks like the module is working as intended, and sending response to frontend with 'data-nosize' attribute set correctly. But in pwimage plugin for CKEditor, nosize setting isn't used at all.

// pwimage/plugin.js
function insertImage(src) {
    var $i = $iframe.contents();
    var $img = jQuery("#selected_image", $i);
    // ...
    var $insertHTML = jQuery("<img />").attr('src', src).attr('alt', alt);
    // ...
    if (width > 0) $insertHTML.attr('width', width);

    // ...
    editor.insertHtml(html);
    // ...
}

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By masslevel
      Hello, community!

      Does anyone have an idea how to limit a Textarea field with CKEditor to just one line/row?
      I'm using the Textarea field in a repeater and CKEditor because it needs to hold formulas. I would use a simple text field, but I need the formatting options like super-/subscript, underline etc.
      None of the below methods seem to be working.

      Are there any other methods you may know or have used before that can restrict CKEditor to a single row? Or should I use a completely different approach for entering/formatting the content?
      I tried these approaches:

      #1 Redirecting enter and shift+enter keys
      https://stackoverflow.com/a/7991519
      When the doNothing plugin is enabled CKEditor won't load on the edit page - the space is blank. There's a parsing error. I tried to modify the plugin - no luck.

      #2 Using the blockedKeystrokes function that was introduced in CKEditor 4
      as a plugin (13 = enter key) config.blockedKeystrokes( 13, CKEDITOR.SHIFT + 13 ); Getting: config.blockedKeystrokes is not a function. Tried also with editor.blockedKeystrokes
      in the config.js and config-fieldname.js
       
      config.blockedKeystrokes = [ 13, CKEDITOR.SHIFT + 13 ]; is getting ignored. does nothing.
      in the Input field settings (Custom Config Options) in ProcessWire blockedKeyStrokes: 13, CKEDITOR.SHIFT + 13 is getting ignored. does nothing.
       
      Thank you so much in advance.
    • By Alex CA
      I have a few fields which are using the textField filedtype. Some of the data for these fields contain LaTeX code.
      However, the CKEditor does not have the abilities to parse it. Is there any solution for this problem?
      I am currently using Processwire 2.7
    • By Roberts R
      Solution :
       
      Issue :
      Fresh install ProcessWire 3.0.39 + multilangual support
      In video it shows how it goes. And I can't figure it out.  It happens for few of my sites.
      td;tl : Upload 5 image in images field ->  Save -> 2 left.
      EDIT : Files are in "/assets/files/id"
      processwire-bug.mp4
    • By cosmicsafari
      Hi all,
      I am working on a site which involves a lot of image upload fields, 99% of the time it works perfectly but I have noticed that every so often image variations will be missing.
      Like the original uploaded image is fine but maybe 1 or 2 out of the variations is just blank.
      The variation files will appear within the assets folder but they will be just in name only without any actual image content.
      Since its quite a random thing I am finding it rather difficult to figure out why this happens?
      Any ideas?
    • By modifiedcontent
      Is there a way to change the input options for the images field?
      I am trying to figure out if it would make sense to use an external script like Zenphoto as a central media library/manager. How could I connect that with Processwire?
      'Choose File' in the images field would have to be able to open that 3rd party media library or a directory on the server or some cloud service instead of (only) the client file manager.
      Could justb3a's field type module Image Extra be part of the solution? I will try that and report back. Other field types/modules?
      I know there is a pro module Media Manager that does look very slick, but would prefer to make this work with a mature, tested 3rd party script if a central media gallery is never going to be a core Processwire feature.