Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy / Pasta Image Resizing #412

Closed
sebastienPoussard opened this issue Jul 3, 2018 · 20 comments
Closed

Copy / Pasta Image Resizing #412

sebastienPoussard opened this issue Jul 3, 2018 · 20 comments

Comments

@sebastienPoussard
Copy link

Greatings,

when i paste an image directly into the editor it convert the image in base 64, after saving the page i can return to edit the page and the image is referred directly to the file
ex : {{.:98aec1475e04ffaca903bc1085038447.png?685x380}}
i can then modify the width and height without problems

when i paste an image directly into the editor it convert the image in base 64, i directly (without saving the page) modify the width, height of the image it cause the server to crash and i'm unable to access the page again without directly modifying the file through SSH

error log ex :

[Tue Jul 03 11:38:49.126650 2018] [core:notice] [pid 18716] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Tue Jul 03 11:38:59.150522 2018] [core:notice] [pid 18716] AH00052: child pid 18725 exit signal Segmentation fault (11)
[Tue Jul 03 11:38:59.150557 2018] [core:notice] [pid 18716] AH00052: child pid 18726 exit signal Segmentation fault (11)
[Tue Jul 03 11:38:59.150577 2018] [core:notice] [pid 18716] AH00052: child pid 18727 exit signal Segmentation fault (11)
[Tue Jul 03 11:38:59.150587 2018] [core:notice] [pid 18716] AH00052: child pid 18728 exit signal Segmentation fault (11)
[Tue Jul 03 11:39:00.152493 2018] [core:notice] [pid 18716] AH00052: child pid 18718 exit signal Segmentation fault (11)
[Tue Jul 03 11:39:00.152556 2018] [core:notice] [pid 18716] AH00052: child pid 18719 exit signal Segmentation fault (11)
[Tue Jul 03 11:39:00.152644 2018] [core:notice] [pid 18716] AH00052: child pid 18720 exit signal Segmentation fault (11)
[Tue Jul 03 11:39:00.152656 2018] [core:notice] [pid 18716] AH00052: child pid 18722 exit signal Segmentation fault (11)
[Tue Jul 03 11:39:00.152669 2018] [core:notice] [pid 18716] AH00052: child pid 18724 exit signal Segmentation fault (11)
[Tue Jul 03 11:39:00.152681 2018] [core:notice] [pid 18716] AH00052: child pid 18729 exit signal Segmentation fault (11)

i don't understand the problem, i tried to disable size modifcation through
" config.disableObjectResizing = true; "
cf : https://docs.ckeditor.com/ckeditor4/latest/api/CKEDITOR_config.html

@turnermm
Copy link
Owner

turnermm commented Jul 3, 2018

You can't resize until the image has been saved.

@sebastienPoussard
Copy link
Author

thanks for the answer, do you know then any way to diseable resizing ? avoiding user errors.

@turnermm
Copy link
Owner

turnermm commented Jul 3, 2018

Not at the moment, but I can try looking at it. But I really can't promise anything.

@sebastienPoussard
Copy link
Author

thanks @turnermm !!
Do you have an explanation why the server crash ?
my guess is one script don't leave the memory and others then can't access it.
i'm just a student but would gladly contribute if possible

@sebastienPoussard
Copy link
Author

@turnermm i found a way to disable size modification

  • to disable size modification with the mouse :
    edit dokuwiki/lib/plugins/ckgedit/ckeditor/ckeditor.js
    set variable CKEDITOR.config.disableObjectResizing = true

  • to disable the window openning when you double click which allow you size modification :
    set this.attachListener(this, "dblclick", function(b) { to something like
    this.attachListener(this, "cant_use_anymore", function(b) {

@sebastienPoussard
Copy link
Author

do you have any ideas on how to save a page after pasting an image and re openning the same page to edit it ? which would avoid any problem with resizing ?

@turnermm
Copy link
Owner

set variable CKEDITOR.config.disableObjectResizing = true

That's good to know. Ill test it out. As for double clicking, when you double click inside a section edit area, the section opens with the DokuWiki editor instead of the CKEditor. You can turn this off in the configuration options.

I don't follow your question about saving. There's nothing stopping you from saving and re-opening.

@turnermm
Copy link
Owner

On second thought, I wouldn't want to turn off mouse-based re-sizing, since that would prevent mouse resizing for all images, not just for copy-pasted.

@sebastienPoussard
Copy link
Author

sebastienPoussard commented Jul 19, 2018

first of all, do you have also a server crash when you resize an image after a Copy/Paste before saving the page ? or is it juste me ?

the best solution would be to prevent those crash but i don't know how to...

after this crash i have to manually delete the page (or at least delete the part where is refer to the B64 image) by connecting to the server SSH/FTP which is not very convenient, every time a user resize an image before saving the page ...

my idea was first to disable image re-sizing which is not of course a very good solution..
a better idea would be to intercept the Copy/Paste event into JS, saving the page and charging it again for edit, in this case the image is uploaded already to the server and can be re-sized without any crash.

what is your opinion on this ?

@turnermm
Copy link
Owner

turnermm commented Jul 19, 2018

This has never been reported before. I assume there is something happening in your PHP on the server which is running your dokuwiki . You haven't given any details about your server--its Operating System, its version of PHP. By re-sizing before the image has been saved, you corrupt the image data. and your system can't handle this for some reason. So it would be good to have these details from you.

Also, I am attaching a zip file with a copy of action/save.php that has some error handling in it. Unzip it and substitute this save.php for the one currently installed and see if you get an error message. And hopefully by catching the error it will prevent the crash.
save.zip

@sebastienPoussard
Copy link
Author

i have the exact same error with :

  • Server in VMware, CentOS 7, Apache 2.4.6 , PHP 7.1.19
  • Local : Windows 10, WAMP, Apache 2.4.33 , PHP 5.6.35

i figured it wasn't linked to the server since i have same result on both configurations

i did try to replace your save.php dokuwiki\lib\plugins\ckgedit\action without any change.
Do you have any suggestions about how to investigate further the crash's origin ?

@turnermm
Copy link
Owner

The fact that you get a segmentation fault means that there is a server error. The common failures may have to do with how you set up your servers or the capapcity of your servers.. How big are these servers? How much ram? I just ran a test on a small linux vps, it didn't crash. Similarly , Window 10, and a small Ubuntu server, and a Centos server.

@sebastienPoussard
Copy link
Author

  • for WAMP with W10
    the problem appear with PHP 5.6.35
    the problem is solved with PHP 7.0.29 , 7.1.16 or 7.2.4
  • for CentOS 7 i have 2Go RAM, 16Go Drive
    Apache/2.4.6 PHP v7.2.8
    i tried downgrade PHP to v7.1.20 and to v7.0.31
    now im trying to switch to a nginx server...

@sebastienPoussard
Copy link
Author

sebastienPoussard commented Jul 20, 2018

2018/07/20 15:36:53 [error] 25903#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.140.223.43, server: 10.140.213.9, request: "GET /dokuwiki/doku.php?id=dsfsdf HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "10.140.213.9", referrer: "http://10.140.213.9/dokuwiki/doku.php?id=start&do=index"
is the error i get with nginx

can you share your RAM / apache / php on your CentOS ?

@turnermm
Copy link
Owner

My apache on all servers is 2.4. The ram on my ubuntu vps is 768 meg, with hd allocation of 24GB. The others are full sized servers with 16GB ram, full sized disks..

@sebastienPoussard
Copy link
Author

well... i don't have other ideas to investigate further, i tried to compile php with--enable-debug
but linking a fresh compiled php to apache is too difficult for me... the idea was to create php core dump to investigate further...

@sebastienPoussard
Copy link
Author

i think i found the origin of the problem,
i installed dokuwiki on my private server, there was not any crash.
i think the problem come from the server i use in my compagny, the're all virtualized in vSphere / VMware.
i read somewhere a user having that kind of php crash was connected to his socket drivers. i suspect the socket driver crashing for some reason in vSphere.

@turnermm
Copy link
Owner

Thanks for the update.

@sebastienPoussard
Copy link
Author

thanks for you help @turnermm

@sebastienPoussard
Copy link
Author

FYI : the problem is the same with HyperV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants