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

Create PDF thumbnails #20

Open
jqnatividad opened this issue May 20, 2015 · 3 comments
Open

Create PDF thumbnails #20

jqnatividad opened this issue May 20, 2015 · 3 comments

Comments

@jqnatividad
Copy link
Contributor

Have an INI option to automatically create thumbnails using ImageMagick and Ghostscript (apt-get install imagemagick ghostscript)

For simplicity, also specify a www-readable directory where thumbnails are created.

The CKAN admin can also optionally specify in the INI file the ImageMagick convert parameters to size the thumbnail. If not specified, default thumbnail will be generated as follows:

convert -thumbnail x300 -background white -alpha remove input_file.pdf[0] output_thumbnail.png

To simplify pulling up the thumbnail in templates, the thumbnail will use the resource ID in the filename - [resource ID]_thumb.png, with [resource ID] being directory-sharded on first two hyphens - e.g. the thumbnail for a PDF with resource ID 9efec242-c83b-46c8-9574-ab5c6e37e11c is stored in /var/lib/ckan/default/thumbnails/9efec242/c83b/46c8-9574-ab5c6e37e11c_thumb.png, assuming the thumbnail directory is set to /var/lib/ckan/default/thumbnails.

The thumbnail will be generated if it doesn't exist when calling can_view. In this way, PDF resources uploaded earlier will have thumbnails as well.

What do you think of this approach @amercader ?

@jqnatividad
Copy link
Contributor Author

Will just do a generic thumbnail extension instead of one specific to ckanext-pdfview.

@jqnatividad
Copy link
Contributor Author

Reopening. This became a requirement for one installation which we implemented. Will be an optional feature that's off by default so existing installations will not have a problem.

@jqnatividad
Copy link
Contributor Author

@jguo144 implemented this already and will submit a PR

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

No branches or pull requests

1 participant