TinyMCE image uploader is broken

Hi,

I have noticed that the image uploader in journal setup page is not working. It happens in both of our 2.3.7 and 2.4.6 versions.
It is very similar to issue logged here: Upload images from any user in OJS
As soon as I click the image icon, below error occurs:

failed to load /[journal_initials]/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/jbimages/ci/index.php/blank/english
404 Not Found

When I browse and select an image to be uploaded, the spinner keeps spinning and below error occurs:

/[journal_initials]/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/jbimages/ci/index.php/listImages/

rest_url os on and base_url[journal_initials] is set.
TinyMCE plugin is enabled also.

The error logged in server log:

404 Not Found -- RequestPath: /[journal_initials]/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/jbimages/ci/index.php/listImages/, referer: https://dev-demo1.library.qut.edu.au/lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/jbimages/dialog.htm

Also I have this warning on the setup page:

Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.

generated by tiny_mce_gzip.js:58

I’d appreciate your help in that.

Hi @salehig,

I am trying to reproduce your problem. What is your rewrite rule?

Thanks,
Bruno

I tried adding below condition to the current rewrite rules. didn’t help.

RewriteCond %{REQUEST_URI} !^/(tiny_mce|jbimages)/ [NC]

My current rules:

  # Redirect requests for root to default journal homepage
    RewriteCond %{REQUEST_URI} =/
    RewriteRule .* /index

    # Rewrite RESTful site admin URLs
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
    RewriteRule ^(/index/.*)$ /index.php$1 [QSA,L]

    # Redirect old website URLs to new ones
    RewriteRule ^/journal/?$ https://%{SERVER_NAME}/$1 [R=301,L]
    RewriteRule ^/journal/index\.php/intjfyhe/(.*)$ https://%{SERVER_NAME}/$1 [R=301,L]
    RewriteRule ^/journal/(public/.*)$ https://%{SERVER_NAME}/$1 [R=301,L]

    # Rewrite requests for RESTful URLs to full URLs,
    # e.g., /about to /index.php/intjfyhe/about
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^(/spep/|/index\.php)
    RewriteRule ^(.*)$ /index.php/intjfyhe$1 [QSA,L]

    # Rewrite requests for RESTful URLs to full URLs,
    # e.g., /about to /index.php/intjfyhe/about
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_URI} !^(/spep/|/index\.php)
    RewriteRule ^(.*)$ /index.php/test$1 [QSA,L]

In config.inc.php:
base_url = “https://dev-demo1.library.qut.edu.au
base_url[intjfyhe] = “https://dev-demo1.library.qut.edu.au
base_url[test] = “https://dev-demo1.library.qut.edu.au/index.php/test
display path_info = Off

Thanks

hi @beghelli,

Did you have any clue regrading this?

Best Regards
Ghazal

I checked TinyMCE version integrated with ojs 2.4.6 (latest avalable). It is 3.4.9 which is quite behind. The latest TinyMCE version available is 4.2.5.

Anyway I noticed there was a fix in TinyMCE 3.5b2:

Saying:
Fixed bug where WebKit would fail to open the image dialog since it would be returning false for a class name instead of a string

I was wondering if anyone is aware of this or it might be related?

Thanks

Hi @salehig,

I’ll leave @beghelli to follow up – but just to note that OJS 3.0 already has an updated TinyMCE. Currently OJS 3.0 is in beta, so please watch our website for concrete release plans. Until then it’s under development and not ready for production use.

I don’t think the problem you’re encountering is related to that bug – the image uploader is known to be working for many users on a variety of platforms, so it’s likely to be related to file permissions or a specific rewrite setup.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi,

This issue is not solved yet. I wanted to debug lib/pkp/lib/tinymce/jscripts/tiny_mce/plugins/jbimages/integratePKP.php to see valuse for baseUrl and ImageDir. However it seems it never gets to this file. I even tried disabling and enabling TinyMCE plugin. Which didn’t help. Would you please advice?

Actually we have already released and the site is available publicly. (version 2.4.6)

you can try image uploader on user profile page for example.

Thanks heaps.

Ghazal

Hi @salehig,

I think you have this problem: PKPRequest::getBasePath() returns incorrect results with mod_rewrite on subdirectory · Issue #345 · pkp/pkp-lib · GitHub

It is solved now for OJS 2.4.8. Can you try to upgrade and see if it solved the problem?

If upgrading is a problem, I think that the commits to solve the issue would apply without a problem in OJS 2.4.6, but didn’t tested.

Cheers,
Bruno

Thanks @beghelli. I tried adding that commit to my 2.4.6 version, but it didn’t fix the issue upload image. I think we wait for the stable version 3.0. Is there any estimation of the release date for that one?

Thanks
Ghazal

i have a same problem, when I’m upgade to 2.4.8.3. I cann’t upload image. the image is always broken.
upload%20image%20failed2
please help me how to solve this problem, thanks

@hardi, do you have any re-write rules in place? Can you use the browser’s Web Inspector to share the details of the request and server response for this image?