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

'make html' generates correct IMG, but 'make publish' does not #69

Open
netllama opened this issue Nov 26, 2022 · 10 comments
Open

'make html' generates correct IMG, but 'make publish' does not #69

netllama opened this issue Nov 26, 2022 · 10 comments

Comments

@netllama
Copy link

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:

![](llamaland/img/2022/11/IMG_20221113_082400.jpg){: .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.

@patrickfournier
Copy link
Collaborator

What HTML do you get when you run make publish ?

@netllama
Copy link
Author

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)">

@patrickfournier
Copy link
Collaborator

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.

@netllama
Copy link
Author

netllama commented Jan 1, 2023

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.

patrickfournier added a commit to patrickfournier/image-process that referenced this issue Jan 6, 2023
patrickfournier added a commit to patrickfournier/image-process that referenced this issue Jan 6, 2023
@patrickfournier
Copy link
Collaborator

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.

@netllama
Copy link
Author

netllama commented Jan 7, 2023

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?

@patrickfournier
Copy link
Collaborator

Yes; you will also need to add the path to the plugin to your pelicanconf.py

PLUGIN_PATHS = ["plugins_dev/image-process/pelican/plugins"]

@netllama
Copy link
Author

netllama commented Jan 9, 2023

ip.log

I did as you requested. I'm attaching the output for all the image_process DEBUG output.

@patrickfournier
Copy link
Collaborator

patrickfournier commented Jan 9, 2023

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.

@netllama
Copy link
Author

ip0.log

Seems that you're right, the src attribute is missing. This makes no sense to me either.

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

No branches or pull requests

2 participants