'make html' generates correct IMG, but 'make publish' does not
I'm running pelican-4.8.0 with pelican-image-process-3.0.3. My pelicanconf.py has:
IMAGE_PROCESS = {
"large-photo": {
"type": "responsive-image",
"sizes": (
"(min-width: 1600px) 1420px, "
"(min-width: 1200px) 1020px, "
"(min-width: 992px) 860px, "
"(min-width: 768px) 748px, "
"100vw"
),
"srcset": [
("600w", ["scale_in 600 450 True"]),
("800w", ["scale_in 800 600 True"]),
("1600w", ["scale_in 1600 1200 True"]),
("2000w", ["scale_in 2000 1600 True"]),
],
"default": "800w",
},
}
and my markdown files have code similar to the following:
{: .image-process-large-photo}
When I run 'make html', the generated HTML has the correct expected code such as:
<img alt="" class="image-process-large-photo" sizes="(min-width: 1600px) 1420px, (min-width: 1200px) 1020px, (min-width: 992px) 860px, (min-width: 768px) 748px, 100vw" src="llamaland/img/2022/11/derivatives/large-photo/800w/IMG_20221113_082400.jpg" srcset="llamaland/img/2022/11/derivatives/large-photo/600w/IMG_20221113_082400.jpg 600w, llamaland/img/2022/11/derivatives/large-photo/800w/IMG_20221113_082400.jpg 800w, llamaland/img/2022/11/derivatives/large-photo/1600w/IMG_20221113_082400.jpg 1600w, llamaland/img/2022/11/derivatives/large-photo/2000w/IMG_20221113_082400.jpg 2000w"/>
However, when I run 'make publish' its as if the image-process plugin isn't used at all, and I end up with the full size images all the time. There's nothing in publishconf.py related to the plugin.
I'm confused why this isn't working correctly.
What HTML do you get when you run make publish ?
I end up with this:
<img alt="" class="image-process-large-photo" src="[llamaland/img/2022/11/IMG_1144.JPG](view-source:https://netllama.linux-sxs.org/llamaland/llamaland/img/2022/11/IMG_1144.JPG)">
This is really unexpected.
If you could set up a minimal project that reproduces this problem and post it here, it would help me finding its cause.
Unfortunately, I cannot reproduce this with a minimal project. It definitely requires my full environment.
That said, I'm quite willing to test a debug version of the plugin that prints more verbose output, if that would be helpful.
When you have a chance, pull and checkout branch diagnostic/issue-69 from my fork https://github.com/patrickfournier/image-process/tree/diagnostic/issue-69. Then run DEBUG=1 make publish. For each image, you should get something similar to this in the console:
DEBUG [image_process] Found setting reportage-photo-inline for image /photos/P3240122.JPG. image_process.py:337
DEBUG [image_process] Setting src to /photos/derivees/reportage-photo-inline /// 801w /// P3260132.JPG. image_process.py:486
DEBUG [image_process] /home/you/site/content/photos/P3260132.JPG -> /home/you/site/output/photos/derivees/reportage-photo-inline/651w/P3260132.JPG image_process.py:732
DEBUG [image_process] /home/you/site/content/photos/P3260132.JPG -> /home/you/site/output/photos/derivees/reportage-photo-inline/801w/P3260132.JPG image_process.py:732
DEBUG [image_process] /home/you/site/content/photos/P3260132.JPG -> /home/you/site/output/photos/derivees/reportage-photo-inline/1602w/P3260132.JPG image_process.py:732
DEBUG [image_process] Setting srcset to /photos/derivees/reportage-photo-inline/651w/P3260132.JPG 651w, /photos/derivees/reportage-photo-inline/801w/P3260132.JPG 801w, /photos/derivees/reportage-photo-inline/1602w/P3260132.JPG 1602w. image_process.py:503
Please report what you are getting.
I'm currently using image-process from a pip install inside of a virtenv. If I pull your branch locally, and then (from inside my virtenv) run pip install -U . from image-process/pelican/plugins/image_process will that give me the debug version?
Yes; you will also need to add the path to the plugin to your pelicanconf.py
PLUGIN_PATHS = ["plugins_dev/image-process/pelican/plugins"]
It looks like the HTML received by image_process does not contain values in the <img> tag src attribute. I added more debug output in the code so you can view the HTML received by image_process. Just pull the latest revision of my fork to get them.
You should now see something like this:
DEBUG [image_process] 118 Fragment content: <div class="figure"> image_process.py:332
<img alt="The alt text." class="image-process-some-class" src="/photos/P5020337.JPG" />
<p class="caption">The caption.</p>
</div>
<p>Some text</p>
DEBUG [image_process] 119 Found <img>: <img alt="The alt text." class="image-process-some-class" src="/photos/P5020337.JPG"/> image_process.py:336
I am guessing that the src attributes will be empty on your side.
I am not sure why this is happening, but it happens before image_process does its work.