pelican-plugins / photos Goto Github PK
View Code? Open in Web Editor NEWPelican plugin that adds photos to articles
Pelican plugin that adds photos to articles
Pillow deprecated "textsize" a few versions back and now throws an error.
Pillow 10.1.0 throws an error:
ERROR Could not process pages/page.md log.py:94
'ImageDraw' object has no attribute 'textsize'
Pillow now calls it "textlength"
I see it on line 1322...
text_size = draw_watermark.textsize(
self._pelican_settings["PHOTO_WATERMARK_TEXT"], font
)
Sorry, not confident enough to open a pull request. See also netbox-community/netbox-qrcode#48 Broke their code too.
I created a hidden post where I plan to have the comprehensive gallery of all the photos in a certain category, however, the only way to make this work currently is to make the posts as published and then revise as hidden.
This works until I need tweak the theme and need to re-generate all the photos.
Is this something that can be fixed easily?
I tried to publish a new release but it fails with an error. @justinmayer can you please have a look at it. Might be it is also with other plugins and has something to do with the autopub?
Run autopub prepare
autopub prepare
autopub commit
autopub build
autopub githubrelease
shell: /usr/bin/bash -e {0}
env:
PYTEST_ADDOPTS: --color=yes
pythonLocation: /opt/hostedtoolcache/Python/3.10.13/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib
GITHUB_TOKEN: ***
Cannot append the GitHub contributor due to missing dependency: httpx
Error: Process completed with exit code 1.
If we list the images in the blacklist.txt like in the example below ...
image1.jpg
image2.jpg
... it shows the following warnings and doesn't exclude the files.
WARNING Wrong format in file content/[...]/blacklist.txt on line 1
WARNING Wrong format in file content/[...]/blacklist.txt on line 2
To make it work we have to use.
image1.jpg:
image2.jpg:
This is not expected and not documented.
I'm using version 1.4.0 from pip installation.
A lot of the photos in my gallery aren't getting rendered and a lot of errors display when running pelican -r -l
. I'm getting the wrong format warning for blacklist.txt but it still appears to be omitting the listed images. Note that some images do get created but others do not. I tried setting the PHOTO_EXIF_KEEP
to false and some images still don't get created.
[11:03:48] WARNING Wrong format in file /home/mstuart/Pictures/Personal/Blog/20220907/blacklist.txt on line 1 log.py:91
WARNING Wrong format in file /home/mstuart/Pictures/Personal/Blog/20220907/blacklist.txt on line 2 log.py:91
WARNING Wrong format in file /home/mstuart/Pictures/Personal/Blog/20220907/blacklist.txt on line 3 log.py:91
WARNING Wrong format in file /home/mstuart/Pictures/Personal/Blog/20220907/blacklist.txt on line 4 log.py:91
WARNING Wrong format in file /home/mstuart/Pictures/Personal/Blog/20220907/blacklist.txt on line 5 log.py:91
WARNING Wrong format in file /home/mstuart/Pictures/Personal/Blog/20220907/blacklist.txt on line 6 log.py:91
ERROR photos: 'GPS' log.py:96
WARNING photos: An exception occurred log.py:91
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/home/mstuart/.local/lib/python3.10/site-packages/pelican/plugins/photos/photos.py", line 1053, in process
image = advanced_func(image, self, *operation_args, **operation_kwargs)
File "/home/mstuart/.local/lib/python3.10/site-packages/pelican/plugins/photos/photos.py", line 1147, in _operation_manipulate_exif
image_meta.exif_result.pop("GPS")
KeyError: 'GPS'
"""
The above exception was the direct cause of the following exception:
KeyError: 'GPS'
WARNING Empty alt attribute for image 20220831_195729.jpg in /home/mstuart/Coding/Home/Blog/Pelican/blog.stuieordie.net/content/mt-titcomb-farmington.md log.py:91
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
ERROR photos: Given thumbnail is too large. max 64kB log.py:96
ERROR photos: Given thumbnail is too large. max 64kB log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
Suspension not allowed here
[11:03:49] ERROR photos: encoder error -2 when writing image file log.py:96
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
[11:03:50] ERROR photos: 'GPS' log.py:96
ERROR photos: 'GPS' log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
Suspension not allowed here
ERROR photos: encoder error -2 when writing image file log.py:96
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
ERROR photos: "dump" got wrong type of exif value. log.py:96
41729 in Exif IFD. Got as <class 'int'>.
I found issue #49 (#49) but not sure if this is the same behavior
I have a gallery with multiple images with different rotation data in the exif. I have PHOTO_EXIF_AUTOROTATE
set to true in pelicanconf. When I load the page, the images are not rotated.
I do have the piexif library installed.
I create the gallery with
gallery: {photo}/20220828
in the new article markdown page.
When I run pelican -D -r -l
this is what I see for that file
INFO photos: make photo(PID: 36255) /home/mstuart/Pictures/Personal/Blog/20220828/20220828_133110.jpg -> output/photos/20220828/20220828_133110.jpg photos.py:580
DEBUG tag: ImageLength (257) - type: long (4) - value: b' \n\x00\x00' TiffImagePlugin.py:815
DEBUG photos: Open file /home/mstuart/Pictures/Personal/Blog/20220828/20220828_133110.jpg photos.py:823
DEBUG tag: DateTime (306) - type: string (2) Tag Location: 130 - Data Location: 202 - value: b'2022:08:28 13:29:42\x00' TiffImagePlugin.py:815
DEBUG tag: Orientation (274) - type: short (3) - value: b'\x06\x00' TiffImagePlugin.py:815
DEBUG tag: DateTime (306) - type: string (2) Tag Location: 130 - Data Location: 202 - value: b'2022:08:28 13:31:10\x00'
For comparison when I open this same image in GIMP, it sees asks if I want to rotate the photo and then does so correctly.
Sorry i dont know where to ask for help.
i can put the gallery in articles and it works nice. but when i cut the gallery-header-line and paste it into a page, nothing showing. also no error.
my directory structure is simple:
root
--articles
--images
--pages
i just want to show all images in the imagefolder on a page called 'images'
is there maybe a hidden switch/config? googeling around doesnt show anything in this direction.
i use markdown for the sites.
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
CRITICAL AttributeError: 'NoneType' object has no attribute 'partition' init.py:566
If you want to have images rotated by exif. This is removed.
def manipulate_exif(self, img: PILImage.Image) -> Tuple[PILImage.Image, str]:
is never called because
https://github.com/pelican-plugins/photos/blob/main/pelican/plugins/photos/photos.py#L1028-L1039
is commented out and
im, exif_copy = manipulate_exif(im)
should be
im, exif_copy = self.manipulate_exif(im)
and
https://github.com/pelican-plugins/photos/blob/main/pelican/plugins/photos/photos.py#L1044-L1045
is commented out.
I upgraded from 1.5.0 to 1.6.0 but watermark is still not working. This is the error that I'm getting
"photos: 'setting text direction, language or font features is not supported without libraqm'"
I have the following options in pelicanconf.py
PHOTO_WATERMARK = True
PHOTO_WATERMARK_TEXT = 'jeffmackinnon.com'
If I make PHOTO_WATERMARK
False it runs without issue.
I'm running pelican on windows within a pipenv environment.
It was working great, but my last gallery, which has three photos in its folder, shows fifteen photos when you click on it on the site.
I am happy to provide whatever you need to see in order to try to diagnose this.
Pelican version 4.8.0
pelican-photos 1.3.0
Active page with gallery problem https://www.drgerg.com/mpd-is-just-awesome.html
Thanks!
When using the i18n_subsites
plugin (https://github.com/getpelican/pelican-plugins/tree/master/i18n_subsites), the photos plugin will generate identical directories with the photos for each language. This does not make much sense if the image paths are absolute anyway (<a href="/photos/
) and thus all languages will load the images from the primary language.
Although I'm able to work with this by installing from git (see #70 for my issues) I'd love to get back to a pinned version at some point. Could you cut a 1.5.0 release please?
Add a markdown extension to render a gallery on a page or in an article.
Example
Title: Example page
Heading
-------
Content
[gallery:{photo}directory/images]
More Content
### Subheading
Content
The plugin works great - Thank you!
But when I run pelican to process my content, there is a stream of lines like this:
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
I haven't counted - but I'm assuming one pair of these for each photo. Is that normal behavior? No errors or warnings, and everything works as it should.
Thanks for any thoughts.
Attempting to embed the simplest example into a Pelican markdown article, I get the error log shown below. pelican-photos
installed via pip
.
Can anyone explain what I am missing?
Checking further, pelican appears to be generating HTML with the gallery embedded but with links to a non-existent folder.
Directory structure is:
content/
article.md
galleries/
from-film/
team-90.jpg
(more .jpg files)
In pelicanconf.py
I've got this directive block:
PLUGINS = ['photos']
PHOTO_LIBRARY = "./content/galleries"
#PHOTO_GALLERY = (1024, 768, 80)
#PHOTO_INLINE_GALLERY_ENABLED = True
# explicitly setting this key has zero effect.
#PHOTO_EXIF_KEEP = False
In the article.md
I've got this:
Title: Photo gallery
Date: 2023-09-20 23:00
Summary: How to do pictures
Category: Gallery
Gallery: {photo}from-film/
### Photo gallery ###
image: {photo}/from-film/team-90.jpg
Running on Windows 10 21H2.
>python --version
Python 3.11.4
>pelican --version
4.8.0
>pip install pelican-photos
Requirement already satisfied: pelican-photos in r:\apps\python\lib\site-packages (1.4.0)
Error log when attempting to build:
r:\src\web\test.tld.com>make html
"pelican" "r:/src/web/test.tld.com/content" -o "r:/src/web/test.tld.com/output" -s "r:/src/web/test.tld.com/pelicanconf.py"
[19:11:05] WARNING Docutils has no localization for 'english'. Using 'en' instead. log.py:91
[19:11:06] ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
WARNING photos: An exception occurred log.py:91
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "R:\apps\python\Lib\multiprocessing\pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^^^
File "R:\apps\python\Lib\site-packages\pelican\plugins\photos\photos.py",
line 1023, in process
if pelican_settings["PHOTO_EXIF_KEEP"] and "exif" in image.info:
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
KeyError: 'PHOTO_EXIF_KEEP'
"""
The above exception was the direct cause of the following exception:
KeyError: 'PHOTO_EXIF_KEEP'
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
ERROR photos: 'PHOTO_EXIF_KEEP' log.py:96
Done: Processed 2 articles, 0 drafts, 0 hidden articles, 0 pages, 0 hidden pages and 0 draft pages in 1.36
seconds.
Currently, the SITEURL variable is not substituted in inline_gallery.html. There already seems to be a fix for this, which introduces some very interesting additional functionalities: #84
Maybe this one can be merged?
Best,
Paul
I was digging in to find out why my site generation had slowed down so much after updating dependencies, and I narrowed it down to this plugin. When generating a site from ~640 articles, most of which don't have galleries or images, my site with 1.3.0 pinned takes 15 seconds, and when I upgrade to 1.4.0 that time jumps to over 700 seconds.
I'm not sure why :D Happy to help troubleshoot!
I have a repository that's getting pillow
8 via this plugin, and it looks like that version has some known security advisories. I'd like to upgrade to Pillow 9, but that requires this plugin to do so.
Do you have any plans for that? Is it as easy as "plug in the new version"?
Getting all the files from the namespace package required some extra changes that hatchling isn't great at picking up; the font and license.json files are missing.
Thanks for this great plugin and the continous work on it.
The current release 1.3.0 contains a print statement which causes many many console messages like
<class pelican.plugins.photos.photos.caption>
.
For every image processed there are three of them. When I first used the plugin I thought of it like a feature, but actually it is unintended as it does not provide any useful information about the generation process for the enduser.
In 2561b6b you removed the print message already, but unfortunately the current release is still affected by it. I would suggest to split this commit and release a 1.3.1 hotfix release to overcome this issue.
It would be a pity if new users of pelican-photos get the impression that the pelican ecosystem is still buggy or in an alpha status.
I can create a PR if you want.
Just a documentation update but I found that in your example you link to the googleapis jsquery site using http:// - the lightbox gallery worked fine when I ran pelican -r -l
on localhost, but when I deployed to my web server it did not. After inspecting the page, I found the following error
Mixed Content: The page at 'your-blog-name' was loaded over HTTPS, but requested an insecure script 'http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js'. This request has been blocked; the content must be served over HTTPS.
After updating the template to use HTTPS it worked great.
I can take a stab at some new verbiage in the README if you'd like with a PR.
Hey, I was just trying to use your plugin, and when trying to generate the articles I was testing with, photos does not create a photos folder and subsequently does not process the images either.
I am using Windows 10.
I tried to, but could not replicate the error on a Live Linux system, which leads me to believe, that the problem is due to my OS.
When I try to generate the example from the repo, I get the following log:
[13:05:58] WARNING Watched path does not exist: log.py:91
D:\Development\selfhost\pelican-plugins\photos\examples\content\images
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
<class 'pelican.plugins.photos.photos.CaptionCache'>
<class 'pelican.plugins.photos.photos.ExifCache'>
<class 'pelican.plugins.photos.photos.ExcludeCache'>
[13:05:59] WARNING photos: 'PHOTO_SQUARE_THUMB' log.py:91
Done: Processed 5 articles, 0 drafts, 0 hidden articles, 0 pages, 0 hidden pages and 0 draft pages in 1.51 seconds.```
I
i'm runing the pluging to make a galery, i use my own theme.
i'm running this code :
<div id=galerie>
{{ page.content }}
{% for titre, gallery in page.photo_gallery %}
{% for name, photo, thumb, exif, caption in gallery %}
<a href="{{ SITEURL }}/{{ name }}.html" class=image_lien><img class=img_galerie src="{{ SITEURL }}/{{ photo }}" title= "{{ name }}" alt="{{ caption }}"></a>
{% endfor %}
{% endfor %}
</div>
i choose to use the caption.txt for the alt text of my photos, but on 5 tests photos only 2 have their alt. The name of the pictures are ok and i have reload the site numerous times.
I run pelican on archlinux on a venv with python 3.12.
thanks for help
nael
By default the plugin uses the fonts in the module directory and also the license.json is missing.
Can we just move the static files into the module?
There are some questions on how to use the lightbox feature. We should improve the documentation and add more examples on that topic. For more information about it have a look at getpelican/pelican-plugins#1056
Hi
Im trying to build an example but it fails:
md
articles-pelican == 4.8.0
+pelican[markdown] == 4.8.0
ANTIALIASING
is not there refWhen I use a non default location for ARTICLE_SAVE_AS, e.g.
ARTICLE_SAVE_AS = "articles/{slug}.html"
the images do not show up.
This is due to a missing slash in the generated image-reference.
My directories structure is as follows:
website
and in article.md the image is referenced using
![]({photo}image.jpg)
In my case it outputs this:
<p><a href="photos/image.jpg"><img alt="" src="photos/imaget.jpg"></a></p>
The problem is the relative path. To make it failsafe it should be enough to prepend a slash before "photos" in the output, at least if the settings ARTICLE_SAVE_AS is set.
I think line 1545 of photos.py
python if value.startswith("/"): value = value[1:]
should be touched for that.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.