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

[Bug]: Imaginary doesn't generate previews for PDF #40652

Closed
5 of 8 tasks
enoch85 opened this issue Sep 27, 2023 · 27 comments
Closed
5 of 8 tasks

[Bug]: Imaginary doesn't generate previews for PDF #40652

enoch85 opened this issue Sep 27, 2023 · 27 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug feature: previews and thumbnails

Comments

@enoch85
Copy link
Member

enoch85 commented Sep 27, 2023

⚠️ This issue respects the following points: ⚠️

Bug description

Been trying for a while now to generate previews for PDFs, using Imaginary. Nothing I've tried so far makes it work.

  1. Installed Ghostscript in the docker, and on the host
  2. Added OC\\Preview\\PDF to the config.php file (shouldn't be needed)
  3. Pulled the latest imaginary docker image from AIO

Steps to reproduce

  1. Install AIO docker with this script
  2. Add PDFs to Nextcloud
  3. Reload

Expected behavior

PDFs should generate a preview, but they aren't

Installation method

Community VM appliance

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Upgraded to a MAJOR version (ex. 22 to 23)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "10.150.99.2",
            "cloud.whatever.nu",
            "office.whatever.nu"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "27.1.1.0",
        "overwrite.cli.url": "https:\/\/cloud.whatever.nu\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": true,
        "log_type": "file",
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "loglevel": "2",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "mail_smtpmode": "smtp",
        "remember_login_cookie_lifetime": "1800",
        "log_rotate_size": "10485760",
        "trashbin_retention_obligation": "auto, 60",
        "versions_retention_obligation": "auto, 180",
        "activity_expire_days": "120",
        "simpleSignUpLink.shown": false,
        "memcache.local": "\\OC\\Memcache\\Redis",
        "filelocking.enabled": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0.5,
            "dbindex": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "default_phone_region": "se",
        "logtimezone": "Europe\/Stockholm",
        "htaccess.RewriteBase": "\/",
        "session_lifetime": "1800",
        "session_keepalive": "false",
        "maintenance": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "forwarded_for_headers": [
            "HTTP_X_FORWARDED",
            "HTTP_FORWARDED_FOR"
        ],
        "overwriteprotocol": "https",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "preview_concurrency_new": "8",
        "preview_concurrency_all": "16",
        "enabledPreviewProviders": [
            "OC\\Preview\\Imaginary",
            "OC\\Preview\\Image",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\Movie",
            "OC\\Preview\\Krita"
        ],
        "preview_imaginary_url": "http:\/\/127.0.0.1:9000",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "preview_max_memory": "256"
    }
}

List of activated Apps

Enabled:
  - activity: 2.19.0
  - admin_audit: 1.17.0
  - bookmarks: 13.1.1
  - calendar: 4.5.1
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contacts: 5.4.2
  - contactsinteraction: 1.8.0
  - dav: 1.27.0
  - extract: 1.3.6
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_external: 1.19.0
  - files_fulltextsearch: 27.0.1
  - files_pdfviewer: 2.8.0
  - files_reminders: 1.0.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - firstrunwizard: 2.16.0
  - fulltextsearch: 27.0.1
  - fulltextsearch_elasticsearch: 27.0.2
  - impersonate: 1.14.0
  - integration_google: 2.0.2
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - maps: 1.1.1
  - notes: 4.8.1
  - notifications: 2.15.0
  - oauth2: 1.15.1
  - password_policy: 1.17.0
  - phonetrack: 0.7.6
  - photos: 2.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - related_resources: 1.2.0
  - richdocuments: 8.2.0
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - spreed: 17.1.1
  - survey_client: 1.15.0
  - suspicious_login: 5.0.0
  - systemtags: 1.17.0
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - updatenotification: 1.17.0
  - user_migration: 4.0.1
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - workflowengine: 2.9.0
Disabled:
  - bruteforcesettings: 2.7.0
  - circles: 27.0.1 (installed 23.0.0)
  - dashboard: 7.7.0 (installed 7.1.0)
  - encryption: 2.15.0
  - issuetemplate: 0.7.0 (installed 0.7.0)
  - nextcloud_announcements: 1.16.0 (installed 1.6.0)
  - recommendations: 1.6.0 (installed 0.4.0)
  - support: 1.10.0 (installed 1.0.0)
  - twofactor_reminder: 1.0.0 (installed 1.0.0)
  - twofactor_totp: 9.0.0
  - user_ldap: 1.17.0

Nextcloud Signing status

It's OK

Nextcloud Logs

No response

Additional info

cc @szaimen I can see that you install vips packages in the docker image so it should work out of the box, right?

@enoch85 enoch85 added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Sep 27, 2023
@enoch85 enoch85 changed the title [Bug]: Imaginary doesn't generated previews for PDF [Bug]: Imaginary doesn't generate previews for PDF Sep 27, 2023
@szaimen
Copy link
Contributor

szaimen commented Sep 27, 2023

Yes, it should work out of the box

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

OK, this is confirmed on at least 4 instances running 27.1.1. All with imaginary installed, but no Imagick.

@szaimen
Copy link
Contributor

szaimen commented Sep 27, 2023

2. Added OC\\Preview\\PDF to the config.php file (shouldn't be needed)

If you remove that again does it make it work?

@solracsf
Copy link
Member

'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\Imaginary',
  ),
'preview_imaginary_url' => 'http://10.0.0.1:9000',

Works fine on my side, only Imaginary is a docker container on a remote host, not NC.

@solracsf
Copy link
Member

Some debug if it helps (tested right now with 2 PDFs):

docker logs -f aio-imaginary

10.0.0.10 - - [27/Sep/2023 10:34:15] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22convert%22%2C%22params%22%3A%7B%22type%22%3A%22png%22%7D%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A1024%2C%22height%22%3A1024%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22png%22%2C%22norotation%22%3A%22true%22%2C%22quality%22%3A%2280%22%7D%7D%5D HTTP/1.1" 200 388833 0.4199
10.0.0.10 - - [27/Sep/2023 10:34:16] "POST /pipeline?operations=%5B%7B%22operation%22%3A%22convert%22%2C%22params%22%3A%7B%22type%22%3A%22png%22%7D%7D%2C%7B%22operation%22%3A%22fit%22%2C%22params%22%3A%7B%22width%22%3A1024%2C%22height%22%3A1024%2C%22stripmeta%22%3A%22true%22%2C%22type%22%3A%22png%22%2C%22norotation%22%3A%22true%22%2C%22quality%22%3A%2280%22%7D%7D%5D HTTP/1.1" 200 458698 0.4911

@small1
Copy link

small1 commented Sep 27, 2023

I'll enable some logs on my imaginary instance and see what it says. It doesn't work for me.

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

  1. Added OC\\Preview\\PDF to the config.php file (shouldn't be needed)

If you remove that again does it make it work?

It's already removed, please check the first post.

@solracsf Strange. Running the AIO docker on the same host as Nextcloud. No imagick installed.

Do you have anything extra installed on your machine?

@solracsf
Copy link
Member

No Imagick, no Ghostscript.
Check your container logs and make sure they comunicate.

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

Screencast.from.2023-09-27.12.59.38.webm

@solracsf

@szaimen
Copy link
Contributor

szaimen commented Sep 27, 2023

I just tested with an AIO test-instance that runs 27.1.1 and pdf preview generation using imaginary works fine over here.

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

I just tested with an AIO test-instance that runs 27.1.1 and pdf preview generation using imaginary works fine over here.

Super odd, I will do a 100% fresh install, and test again.

@szaimen
Copy link
Contributor

szaimen commented Sep 27, 2023

Maybe you run into this?
#38911

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

Maybe you run into this? #38911

Hmm, I don't think so since these are my settings:

  array (
    0 => 'OC\\Preview\\Imaginary',
    1 => 'OC\\Preview\\Image',
    2 => 'OC\\Preview\\MarkDown',
    3 => 'OC\\Preview\\MP3',
    4 => 'OC\\Preview\\TXT',
    5 => 'OC\\Preview\\OpenDocument',
    6 => 'OC\\Preview\\Movie',
    7 => 'OC\\Preview\\Krita',
  ),
  'preview_imaginary_url' => 'http://127.0.0.1:9000',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'preview_max_memory' => '256',
);

So it's larger x and y than 512.

@Chartman123
Copy link

@enoch85 You have to look at the called URLs for the previews in your source code of the page... NC automatically requests the normal previews with x=250 and y=250. If you pick a URL from there, open it in a new browser tab and change the parameters to 257, then the preview should appear.

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

@Chartman123 Will try that.

Meanwhile I can confirm that the previews are generated at least for the "details pane":

image

But not in the file list:

image

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

@Chartman123 OK, so it's confirmed to be working.

https://cloud.domain.nu/core/preview?fileId=9150285&c=58362c5cb226fe64beeda5cdc76804c1&x=257&y=257&forceIcon=0&a=1 = working for the PDF.

So is this a bug with the server or Imaginary?

@Chartman123
Copy link

@enoch85 Yes, same for me... In the Details pane the previews are requested with x=1920&y=1080.

This seems to be Imaginary related. As soon as I disable it in the config PDF previews start to work again as expected.

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

Noticed the same thing for TIF now. Changing to 257X257 on that made the preview appear.

Here's a stack trace from the browser log, doon't know if it helps?

lazyLoadPreview
[https://cloud.domain.nu/js/files/merged-index.js:6634:4](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
_renderRow
[https://cloud.domain.nu/js/files/merged-index.js:6186:11](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
_nextPage
[https://cloud.domain.nu/js/files/merged-index.js:5599:15](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
_onScroll
[https://cloud.domain.nu/js/files/merged-index.js:5449:10](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
Bt
[template.js:98:63](webpack:///nextcloud/node_modules/underscore/modules/template.js)
18181/vt</a<
[partial.js:13:21](webpack:///nextcloud/node_modules/underscore/modules/partial.js)
88809/a/<
[range.js:13:2](webpack:///nextcloud/node_modules/underscore/modules/range.js)
dispatch
[jquery.js:5450:48](webpack:///nextcloud/node_modules/jquery/dist/jquery.js)
19755/</add/f.handle
[jquery.js:5234:28](webpack:///nextcloud/node_modules/jquery/dist/jquery.js)
(Async: EventListener.handleEvent) add
[jquery.js:5291:54](webpack:///nextcloud/node_modules/jquery/dist/jquery.js)
49226/r</<
[jquery-migrate.min.js:2:9551](webpack:///nextcloud/node_modules/jquery-migrate/dist/jquery-migrate.min.js)
49226/r</s/t[n]
[jquery-migrate.min.js:2:1298](webpack:///nextcloud/node_modules/jquery-migrate/dist/jquery-migrate.min.js)
19755/</Me/<
[jquery.js:5177:2](webpack:///nextcloud/node_modules/jquery/dist/jquery.js)
each
[jquery.js:348:30](webpack:///nextcloud/node_modules/jquery/dist/jquery.js)
each
[jquery.js:164:12](webpack:///nextcloud/node_modules/jquery/dist/jquery.js)
Me
[jquery.js:5174:16](webpack:///nextcloud/node_modules/jquery/dist/jquery.js)
on
[jquery.js:5915:15](webpack:///nextcloud/node_modules/jquery/dist/jquery.js)
initialize
[https://cloud.domain.nu/js/files/merged-index.js:4579:20](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
FileList
[https://cloud.domain.nu/js/files/merged-index.js:4202:8](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
initialize
[https://cloud.domain.nu/js/files/merged-index.js:82:20](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
<anonymous>
[https://cloud.domain.nu/js/files/merged-index.js:406:17](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
18181/Ot</<
[bindAll.js:11:33](webpack:///nextcloud/node_modules/underscore/modules/bindAll.js)
(Async: setTimeout handler) 18181/Ot<
[bindAll.js:11:27](webpack:///nextcloud/node_modules/underscore/modules/bindAll.js)
88809/a/<
[range.js:20:2](webpack:///nextcloud/node_modules/underscore/modules/range.js)
Bt
[template.js:98:63](webpack:///nextcloud/node_modules/underscore/modules/template.js)
a
[_executeBound.js:8:8](webpack:///nextcloud/node_modules/underscore/modules/_executeBound.js)
<anonymous>
[https://cloud.domain.nu/js/files/merged-index.js:405:4](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)
(Async: EventListener.handleEvent) <anonymous>
[https://cloud.domain.nu/js/files/merged-index.js:402:8](https://cloud.domain.nu/js/files/merged-index.js?v=29951e7c-8)

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

Also, the JSON output is empty

image

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

A bit more detailed video. This is a 100% fresh install:

Screencast.from.2023-09-27.14.06.23.webm

Did the 257x257 fix on the file.

@Chartman123
Copy link

So in the end, this is indeed a duplicate of #38911, isn't it?

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

Sure, we can close it as that.

@enoch85 enoch85 closed this as completed Sep 27, 2023
@solracsf
Copy link
Member

What are your Imaginary docker compose params?

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

@solracsf

Steps to reproduce

  1. Install AIO docker with this script

https://github.com/nextcloud/vm/blob/master/apps/imaginary.sh#L113-L114

@solracsf
Copy link
Member

Try:

docker run -t -d -p 127.0.0.1:9000:9000 --restart always --name imaginary nextcloud/aio-imaginary –cap-add=sys_nice -concurrency 50 -enable-url-source -return-size -log-level debug

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

@solracsf Doesn't make any difference I'm afraid. :/

@enoch85
Copy link
Member Author

enoch85 commented Sep 27, 2023

Though with imaginary removed, it works:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug feature: previews and thumbnails
Projects
None yet
Development

No branches or pull requests

6 participants