mlibrary / heliotrope

Codebase for Fulcrum, a Samvera-based digital publishing platform built by the University of Michigan Library
https://fulcrum.org
Apache License 2.0
45 stars 9 forks source link

Thumbnails for office documents #104

Closed mark-dce closed 6 years ago

mark-dce commented 8 years ago

STORY As an editor, I would like thumbnails of the first page of office documents to be displayed, so that there is a visual placeholder for the document in various display contexts.

DETAILS We should render the first page, slide, or sheet of an office document an set it as the representative for the file.

ACCEPTANCE

acozine commented 8 years ago

With the addition of libreoffice on the sandbox, PDF thumbnails work. I tested a powerpoint from 2008 and an Excel spreadsheet, and I do not see thumbnails for them.

mark-dce commented 8 years ago

It looks like this is something that got broken in [hydra-derivatives]() between release 1.0.0 and 3.0.0.

On my local machine, I'm able to successfully generate a thumbnail for a Powerpoint (.pptx) file using a Sufia 6.0 app which depends on hydra-derivatives 1.0.0.

On the same machine running heliotrope and hydra-derivatives 3.0.0, trying to upload the same file I get the following error:

NOENT Error on thumbnail

*** got: (Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"136a62f4-264e-4345-8c88-9969f86d1356", "queue_name"=>"derivatives", "arguments"=>["z603qx40z", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/z6/03/qx/40/Fall HydraCamp2013.pptx"], "locale"=>"en"}])
*** Running before_fork hooks with [(Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"136a62f4-264e-4345-8c88-9969f86d1356", "queue_name"=>"derivatives", "arguments"=>["z603qx40z", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/z6/03/qx/40/Fall HydraCamp2013.pptx"], "locale"=>"en"}])]
*** Running after_fork hooks with [(Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"136a62f4-264e-4345-8c88-9969f86d1356", "queue_name"=>"derivatives", "arguments"=>["z603qx40z", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/z6/03/qx/40/Fall HydraCamp2013.pptx"], "locale"=>"en"}])]
*** (Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"136a62f4-264e-4345-8c88-9969f86d1356", "queue_name"=>"derivatives", "arguments"=>["z603qx40z", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/z6/03/qx/40/Fall HydraCamp2013.pptx"], "locale"=>"en"}]) failed: #<Errno::ENOENT: No such file or directory @ unlink_internal - /Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/misc/thumbnail.pdf>

I also see the following error PIPE ERROR (possibly due to spaces in filename?)

*** got: (Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"c88d3cf2-7e1a-4666-b190-73695ca38179", "queue_name"=>"derivatives", "arguments"=>["4q77fr32b", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/4q/77/fr/32/Mark Bussey - Nov. 15 2012.doc"], "locale"=>"en"}])
*** Running before_fork hooks with [(Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"c88d3cf2-7e1a-4666-b190-73695ca38179", "queue_name"=>"derivatives", "arguments"=>["4q77fr32b", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/4q/77/fr/32/Mark Bussey - Nov. 15 2012.doc"], "locale"=>"en"}])]
*** Running after_fork hooks with [(Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"c88d3cf2-7e1a-4666-b190-73695ca38179", "queue_name"=>"derivatives", "arguments"=>["4q77fr32b", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/4q/77/fr/32/Mark Bussey - Nov. 15 2012.doc"], "locale"=>"en"}])]
*** (Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"c88d3cf2-7e1a-4666-b190-73695ca38179", "queue_name"=>"derivatives", "arguments"=>["4q77fr32b", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/4q/77/fr/32/Mark Bussey - Nov. 15 2012.doc"], "locale"=>"en"}]) failed: #<RuntimeError: Unable to execute command "soffice --invisible --headless --convert-to pdf --outdir /Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/misc /Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/4q/77/fr/32/Mark Bussey - Nov. 15 2012.doc". Exit code: pid 62224 SIGPIPE (signal 13)
Error message: >

But, Images and PDFs generate derivatives with no problem RUNS WITHOUT ERROR FOR IMAGES (& pdfs not shown)

*** got: (Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"ce148e91-0b5d-4a65-912e-c30a995bb9de", "queue_name"=>"derivatives", "arguments"=>["9306sz28s", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/93/06/sz/28/Hydra.tif"], "locale"=>"en"}])
*** Running before_fork hooks with [(Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"ce148e91-0b5d-4a65-912e-c30a995bb9de", "queue_name"=>"derivatives", "arguments"=>["9306sz28s", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/93/06/sz/28/Hydra.tif"], "locale"=>"en"}])]
*** Running after_fork hooks with [(Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"ce148e91-0b5d-4a65-912e-c30a995bb9de", "queue_name"=>"derivatives", "arguments"=>["9306sz28s", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/93/06/sz/28/Hydra.tif"], "locale"=>"en"}])]
*** done: (Job{derivatives} | ActiveJob::QueueAdapters::ResqueAdapter::JobWrapper | [{"job_class"=>"CreateDerivativesJob", "job_id"=>"ce148e91-0b5d-4a65-912e-c30a995bb9de", "queue_name"=>"derivatives", "arguments"=>["9306sz28s", "/Users/mark/Documents/workspace/_no_backup/RubymineProjects/heliotrope/tmp/uploads/93/06/sz/28/Hydra.tif"], "locale"=>"en"}])
jgmorse commented 8 years ago

Previous comment withdrawn; I see PPT in the list of files we're expecting.

jmcglone commented 7 years ago

The new external resources icons would solve this, but we have not had this use case yet.

conorom commented 6 years ago

The glyphicons have been in use for some time (replacing the Hyrax default image) so I'm going to disable automatic creation of thumbnails for office documents in Heliotrope (by configuring Hydra Derivatives).

If we ever change our minds, we'll have to go do battle with LibreOffice, i.e. make sure it's on the PATH and that specific components are available. On nectar right now soffice is found OK but something else (oosplash) isn't (same error on both docx and xlsx). Think maybe it does a PDF conversion before grabbing the thumbnail:

Unable to execute command "soffice --invisible --headless --convert-to pdf --outdir /hydra-dev/heliotrope-staging/releases/20180110194444/tmp /hydra-dev/heliotrope-staging/releases/20180110194444/tmp/uploads/hyrax/uploaded_file/file/293/Table_28.docx". Exit code: pid 15625 exit 127 Error message: /usr/bin/soffice: 163: exec: /usr/lib/libreoffice/program/oosplash: not found