{"id":13696193,"url":"https://github.com/pelican-plugins/image-preview-thumbnailer","last_synced_at":"2025-04-10T04:32:42.655Z","repository":{"id":42172453,"uuid":"393015009","full_name":"pelican-plugins/image-preview-thumbnailer","owner":"pelican-plugins","description":"Pelican plugin that insert thumbnails along image links","archived":false,"fork":false,"pushed_at":"2025-03-28T18:16:42.000Z","size":299,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-04T06:36:36.926Z","etag":null,"topics":["artstation","behance","dafont","deviantart","flickr","pelican","pelican-plugin","pelican-plugins","plugin","python","thumbnail-generator","wikiart","wikimedia","wikipedia"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pelican-plugins.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-05T11:22:45.000Z","updated_at":"2025-03-30T03:16:30.000Z","dependencies_parsed_at":"2024-02-20T01:55:55.589Z","dependency_job_id":"a9c37c20-41ea-472a-aa98-105ee2ff98ea","html_url":"https://github.com/pelican-plugins/image-preview-thumbnailer","commit_stats":{"total_commits":42,"total_committers":2,"mean_commits":21.0,"dds":0.0714285714285714,"last_synced_commit":"64e42b13b4caada2aaef1621da24f871425ca9fb"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelican-plugins%2Fimage-preview-thumbnailer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelican-plugins%2Fimage-preview-thumbnailer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelican-plugins%2Fimage-preview-thumbnailer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pelican-plugins%2Fimage-preview-thumbnailer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pelican-plugins","download_url":"https://codeload.github.com/pelican-plugins/image-preview-thumbnailer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248157642,"owners_count":21057047,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["artstation","behance","dafont","deviantart","flickr","pelican","pelican-plugin","pelican-plugins","plugin","python","thumbnail-generator","wikiart","wikimedia","wikipedia"],"created_at":"2024-08-02T18:00:37.204Z","updated_at":"2025-04-10T04:32:42.648Z","avatar_url":"https://github.com/pelican-plugins.png","language":"Python","funding_links":[],"categories":["Plugins"],"sub_categories":["Migrated to new architecture"],"readme":"[![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com)\n[![build status](https://github.com/pelican-plugins/image-preview-thumbnailer/workflows/build/badge.svg)](https://github.com/pelican-plugins/image-preview-thumbnailer/actions?query=workflow%3Abuild)\n[![Pypi latest version](https://img.shields.io/pypi/v/pelican-plugin-image-preview-thumbnailer.svg)](https://pypi.python.org/pypi/pelican-plugin-image-preview-thumbnailer)\n[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)\n\n[Pelican](https://getpelican.com) plugin that insert thumbnails along image links.\n\n\u003e [!WARNING]\n\u003e Since DeviantArt started using CloudFront in 2024, this plugin is not able to produce thumbnails for DeviantArt images.\n\n\u003e However a tested workaround is to use TOR to bypass CloudFront and run the plugin manually on HTML files:\n\u003e `torify path/to/image_preview_thumbnailer.py path/to/page.html`\n\n## Demo page\n\u003chttps://chezsoi.org/lucas/blog/pages/images-libres-de-droits.html\u003e\n\nSource Markdown: [pages/images-libres-de-droits.md](https://github.com/Lucas-C/ludochaordic/blob/master/content/pages/images-libres-de-droits.md)\n\n## Usage instructions\nTo enable this plugin:\n1. Install the package from Pypi: `pip install pelican-plugin-image-preview-thumbnailer`\n2. Add the plugin to your `pelicanconf.py`:\n```python\nPLUGINS = [..., 'image_preview_thumbnailer']\n```\n3. Enable it on the article / pages you wish by inserting this piece of metadata:\n```yaml\nImage-preview-thumbnailer: $selector\n```\n\n`$selector` is a CSS selector to target HTML elements this plugin will parse and look for `\u003ca\u003e` hyperlinks.\nIt can be for example `article` if your Pelican template place your pages content in `\u003carticle\u003e` tags,\nor just `body` to select the whole page.\nSeveral comma-separated values can be provided as CSS selectors to `Image-preview-thumbnailer`.\n\n### Supported link formats\nCurrently this plugin support preview of the following links:\n* \"raw\" links to GIF/JPEG/PNG images\n* links to **Wikipedia/Wikimedia** images\n* links to [ArtStation](https://www.artstation.com) artwork pages\n* links to [Behance](https://www.behance.net) artwork pages\n* links to [Dafont](https://www.dafont.com) font pages\n* links to [FreeSVG.org](https://freesvg.org) vector images\n* links to [Pixabay](https://pixabay.com) images\n* links to pages with a `\u003cmeta property=\"og:image\"\u003e` or `\u003cmeta property=\"twitter:image\"\u003e` properties,\n  like [DeviantArt](https://www.deviantart.com) artworks, [Flickr](https://www.flickr.com) photos, [https://itch.io](itch.io) pages,\n  [OpenGameArt](https://opengameart.org) assets or [WikiArt](https://www.wikiart.org) pages\n\nFeel free to submit PRs to add support for more image hosting websites.\n\n### Only displaying thumbnails on hover\nThe initial idea for this plugin was to just add `🖼️` icons after links to images,\nand then only display thumbnails when hovering on those icons.\n\nTo configure this plugin to behave like this, defines the following in your `pelicanconf.py`:\n```python\nIMAGE_PREVIEW_THUMBNAILER_INSERTED_HTML = '\u003cspan class=\"previewable\"\u003e 🖼️\u003c/span\u003e\u003cimg src=\"{thumb}\" class=\"preview-thumbnail\"\u003e'\n```\n\nAnd insert those CSS rules:\n```css\n                     .preview-thumbnail { display: none; }\n.previewable:hover + .preview-thumbnail { display: block; }\n```\n\n### Usage with images lazyloading\nThere are various Javascript libraries that can provide images lazyloading.\nIf your Pelican template make use of one, you can customize `IMAGE_PREVIEW_THUMBNAILER_INSERTED_HTML` in order to benefit from it.\n\nFor example, to do so using [lazysizes](https://github.com/aFarkas/lazysizes), defines the following in your `pelicanconf.py`:\n```python\nIMAGE_PREVIEW_THUMBNAILER_INSERTED_HTML = '''\u003ca href=\"{link}\" target=\"_blank\"\u003e\n    \u003cdiv class=\"lazyload\" data-noscript=\"\"\u003e\u003cnoscript\u003e\u003cimg src=\"{thumb}\" alt=\"\"\u003e\u003c/noscript\u003e\u003c/div\u003e\n\u003c/a\u003e'''\n```\n\n### Configuration\nAvailable `pelicanconf.py` options:\n\n- `IMAGE_PREVIEW_THUMBNAILER_INSERTED_HTML` (optional, default: `\u003ca href=\"{link}\" target=\"_blank\" class=\"preview-thumbnail\"\u003e\u003cimg src=\"{thumb}\" class=\"preview-thumbnail\"\u003e\u003c/a\u003e`) :\n  the HTML code to be inserted after every link (`\u003ca\u003e`) to an image, in order to preview it\n- `IMAGE_PREVIEW_THUMBNAILER_IGNORE_404` (optional, default: `False`) :\n  avoid raising exceptions that abort Pelican when links are found, pointing to images, but they end up in HTTP 404 errors\n- `SILENT_HTTP_ERRORS` (optional, default: `True`) :\n  avoid raising exceptions that abort Pelican when links are found, pointing to images, but they end up with an HTTP error, of any kind. An error log message is still produced.\n- `IMAGE_PREVIEW_THUMBNAILER_DIR` (optional, default: `thumbnails`) :\n  directory where thumbnail images are stored\n- `IMAGE_PREVIEW_THUMBNAILER_EXCEPT_URLS` (optional) :\n  comma-separated list of regex patterns of URLs to ignore\n- `IMAGE_PREVIEW_THUMBNAILER_THUMB_SIZE` (optional, default: `300`) :\n  size in pixel of the generated thumbnails.\n- `IMAGE_PREVIEW_THUMBNAILER_ENCODING` (optional, default: `utf-8`) :\n  encoding to use to parse HTML files\n- `IMAGE_PREVIEW_THUMBNAILER_HTML_PARSER` (optional, default: `html.parser`) :\n  parse that BEautifulSoup will use to parse HTML files\n- `IMAGE_PREVIEW_THUMBNAILER_CERT_VERIFY` (optional, default: `False`) :\n  enforce HTTPS certificates verification when sending linkbacks\n- `IMAGE_PREVIEW_THUMBNAILER_REQUEST_TIMEOUT` (optional, in seconds, default: `3`) :\n  time in seconds allowed for each HTTP linkback request before abandon\n- `IMAGE_PREVIEW_THUMBNAILER_SELECTOR` (optional, default: `body`) :\n  CSS selector to target HTML elements this plugin will parse and look for `\u003ca\u003e` hyperlinks.\n- `IMAGE_PREVIEW_THUMBNAILER_USERAGENT` (optional, default: `pelican-plugin-image-preview-thumbnailer`) :\n  the `User-Agent` HTTP header to use while sending notifications.\n- `IMAGE_PREVIEW_THUMBNAILER` (optional, default: `False`) :\n  enable the plugin on all your pages\n\nAvailable metadata entries:\n```yaml\nimage-preview-thumbnailer: $selector or just true\nimage-preview-thumbnailer-except-urls: same as IMAGE_PREVIEW_THUMBNAILER_EXCEPT_URLS\nimage-preview-thumbnailer-ignore-404: same as IMAGE_PREVIEW_THUMBNAILER_IGNORE_404\nimage-preview-thumbnailer-inserted-html: same as IMAGE_PREVIEW_THUMBNAILER_INSERTED_HTML\nimage-preview-thumbnailer-thumb-size: same as IMAGE_PREVIEW_THUMBNAILER_THUMB_SIZE\n```\n\nYou will also have to define a `$PIXABAY_API_KEY` environment variable\nto download images from [Pixabay](https://pixabay.com).\n\n\n### Release notes\n_cf._ [CHANGELOG.md](CHANGELOG.md)\n\n## Contributing\nContributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation,\nadding missing features, and fixing bugs. You can also help out by reviewing and commenting on [existing issues](https://github.com/pelican-plugins/image-preview-thumbnailer/issues).\n\nTo start contributing to this plugin, review the [Contributing to Pelican](https://docs.getpelican.com/en/latest/contribute.html) documentation,\nbeginning with the **Contributing Code** section.\n\n### Releasing a new version\nWith a valid `~/.pypirc`:\n\n1. update `CHANGELOG.md`\n2. bump version in `pyproject.toml`\n3. `poetry build \u0026\u0026 poetry publish`\n4. perform a release on GitGub, including the description added to `CHANGELOG.md`\n\n## Linter \u0026 tests\nTo execute them:\n\n    pylint *.py\n    pytest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpelican-plugins%2Fimage-preview-thumbnailer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpelican-plugins%2Fimage-preview-thumbnailer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpelican-plugins%2Fimage-preview-thumbnailer/lists"}