An
without a set width and height in CKEditor will fail to be properly handeled by the modules "image resize filter" and "html purifier".
This results in image size restrictions being ignored and the possibility of a site crippling image (ie 1900px X 2100px) to be inserted into ckeditor. The simple solution would be to set any empty or absent height or width values to that their image's respective dimension.
I would appreciate feedback on this, since this is a real concern of mine. I am currently building a site for a non-profit that will have many users who are on the far end of computer illiterate, and the possibility of this scenario happening is only a question of time.
Comments
Comment #1
bryancasler commented**Correction to my first sentence, sorry for the sloppy editing**
An image without a set
Comment #2
okkingaj commentedIf you using ckeditor in conjunction with ckfinder there is a workaround that avoids crippling your site by restricting size.
In ../sites/all/modules/ckeditor/ckfinder there is a file "config.php" In that file there is a string where you can set resize-to dimensions when uploading.
This is the string that sets size:
$config['Images'] = Array(.
'maxWidth' => 640,
'maxHeight' => 480,
'quality' => 80);
But again this is a workaround. It is bloody annoying that you cannot resize in the image dialog box of CKEditor in combination with filtered html.
Align text lef or align right does not work either. Apparently you need to mess around with the style sheets to fix this: http://drupal.ckeditor.com/troubleshooting#7
Comment #3
Geijutsuka commentedI am also having a really big problem with CKeditor not resizing images correctly.
I'm using the Image Caption and Insert module (which were working nicely with FCKeditor) and CKeditor simply tosses the specified image sizes into the "styles" field instead of where they should be (in the image tag). This throws Image Caption completely into wack and makes an already difficult task of user-friendly inline image insertion and captioning even more frustrating...
Comment #4
okkingaj commentedTry htmlpurifier. It works very nicely with ckeditor and ckfinder.
Comment #5
Geijutsuka commentedHow would one go about setting HTML Purifier to do such a thing? Isn't the issue that CKEditor's inability to set width and height breaks some of HTML Purifier's functionality? How it could be used to make CKEditor use image attributes instead of styles to define image dimensions?
Comment #6
bryancasler commentedImage Resize Filter just added a functionality that pulls in unset
Height and Width dimensions
http://drupal.org/project/image_resize_filter
Comment #7
Geijutsuka commentedYes, Image Resize Filter does put in unset height and width dimensions, but the width and height are left also defined in an inline style--which still breaks Image Caption containing div (class="image-caption-container"). It is absolutely ridiculous how many modules need to be downloaded and how many hoops of fire a person has to jump through just to make inserting inline images and giving them captions a user-friendly process! CKEditor is the last hoop of fire, and it turns out it's too small to jump through. Extremely frustrating.
Comment #8
bryancasler commentedYa, I agree. I can not get this process to be easy for my users at all.
Comment #9
Geijutsuka commentedI found this JavaScript that makes image caption work for CKEditor... doesn't solve the root of the problem, but this is one work-around for at least one module.
http://drupal.org/node/368459#comment-1263415
I renamed the original JavaScript "image_caption.js_original" and made new file called "image_caption.js."
The bummer is that you have to remember to keep this file elsewhere, replace it every update and make sure it works with the update.
Comment #10
megan_m commentedI just found this post when searching for the image height/width attribute problem in CK editor. There is a bug report on CKeditor here:
http://dev.fckeditor.net/ticket/5547
But the developer has closed it saying that this is perfectly acceptable behaviour. Obviously it is causing problems for some with Drupal. As a developer I find this behaviour to be just wrong but can't think of a good explanation as to why. Those of you who are having problems might want to visit that bug report :)
Comment #11
bryancasler commentedgeijutsuka how did you go about implementing that?
Comment #12
Geijutsuka commentedanimelion-
In the Image Caption module folder there's a file called image_caption.js. I renamed that file to "image_caption.js_original" and then I made a new JavaScript file called "image_caption.js" and pasted the JavaScript found in the post by anrikun (http://drupal.org/node/368459#comment-1263415) into the new file. Then I put the file in the Image Caption module's folder and uploaded the new script. The caption divs worked correctly after I did that.
That ticket should definitely not be closed... this is a major problem with a lot of the inline image modules I'm using.
Comment #13
bryancasler commentedThanks a million, got it working.
Comment #14
wwalc commentedComment #15
opegasus commentedYeah issue is still not resolved. I have end users who really need the resize to work or it almost makes CKfinder a mute point. Large pictures remain in original size and break the page.
Nice to have a bazillion work a-rounds and patches and redirecting all over the place but that flat out defeats the plug-in's point in the first place. Hopefully this will be addressed very soon.
Comment #16
Geijutsuka commentedAs stated by opegasus above, this issue is still very much alive and it's still just as frustrating. Forgive me for setting the issue back to active, but this is still a big problem and people should be aware of it.
Comment #17
jmwhitco commentedJust wanted to add my frustration to this issue as well. I've been working on an easy way to let content editors re-size images and justify them left and right. I have the Styles combo box fix implemented and just installed the resize_input_filter module today. Both of these seem promising "workarounds". Now, going to search for the problem of images going back to their original size when I edit an existing page.
Grrr...
Comment #18
ricks03 commentedI'm not sure if it's ckeditor's fault. I spent a while tinkering with it and was getting very frustrated. then I changed the Input Format to Full HTML, and ckeditor then resizes images fine. Not sure which tag I need to add to the input format, but perhaps that will help others.
Comment #19
nairb commentedOpting to set inline styles instead of using valid height and width attributes does not make any sense to me. It creates numerous implementation problems and is also an accessibility issue. While no wysiwyg editor is without drawbacks, ckeditor is currently the most promising solution for me. I have spent far too much time messing with this...
Take a look at you look at cdkeditor/_samples/output_html.html
Insert an image and look at the source, you will notice that the width and height attributes are specified. If you view the page source, you can see the code that is used to rewrite the css styles as attributes. I modified how that code is called and placed it in the ckeditor.config.js file. Now it will run automatically for any textarea.
I am including a vanilla config file with the changes at the bottom. Changes begin with: CKEDITOR.on( 'instanceReady', function( ev )...
Hopefully this will help some of you.
-Brian
Comment #20
jcisio commentedIt looks good, nairb. However, you should provide only the last part of your config file ;)
Personally, I can't see any compatibility problem. image_resize_filter support the width/height in style months ago. Those modules, updated years ago, need to change, not CKEditor have to change to be compatible with old, outdated modules.
About the filter, as suggested in #4 or #18, use another filter. IMO htmlpurifier is a good filter to use with a wysiwyg editor.
Comment #21
Anonymous (not verified) commentedThanks for the patch nairb - worked great for me.
I agree wtih jcisio that this should ideally be changed in other modules, not CKeditor.
My issue arose from Image Caption stripping the style tag out. Image Caption should be modified to leave the height/width alone IMO. After reading the link in #10, I have to agree with the creators of CKeditor.
Comment #22
bryancasler commentedRelated #1207116: Image Resize Filter may create broken paths if height/width attributes are not available
Comment #23
aharown07 commentedFound the file in #19 very helpful. Thanks nairb!
Question--this is a bit of a separate issue I suppose, but can anyone tell me how to make it add a little margin or padding to the inline style stuff, too?
(Wrapping it in css classes for imgleft and imgright would be even better... no idea how to make ckeditor do that and searching has not turned up this info for me.)
Comment #24
headstartcmsI find a bugs of version CKeditor 3.6.2. The table doesn't function properly row and column.
Can i update the version into 3.6.3 without loosing the format ? www.headstartcms.com
Comment #25
dczepierga commentedAs @jcisio write - image_resize_filter support the width/height in style, so pls update your image_resize_filter module to newest version.
@headstartcms, yes u can update to new version, but next time if u have any problems pls open new issue.
I closed this issue, because problem is fixed by image resice filter module.
Greetings
Comment #26
headstartcmsthanks for the response. www.headstartcms.com
Comment #27
knalstaaf commentedI'm not reopening this issue, but I wanted to mention it nonetheless: the IRF-module doesn't seem to work in IE ("surprisingly") and Webkit-browsers. It's already addressed though: #839130: Image resize filter doesn't work on IE or Chrome