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

External images are not filtered out #33

Closed
kdeldycke opened this issue Nov 27, 2020 · 3 comments
Closed

External images are not filtered out #33

kdeldycke opened this issue Nov 27, 2020 · 3 comments
Labels

Comments

@kdeldycke
Copy link
Member

When image-process encounters non-local images, it try to open them and fail with this message:

$ pelican --verbose ./content
(...)
-> Writing /Users/kde/blog/output/2017/01/meta-package-manager-230/index.html
CRITICAL: [Errno 2] No such file or directory: '/Users/kde/blog/content/comics/universal_install_script.png'

Here I expect the plugin to detect the image resource as external, print a warning and skip the transformation altogether. Is that reasonable?

I'm using the latest version from the master branch.


Here is the detailed case, starting with this Markdown:

![XKCD #1654](https://imgs.xkcd.com/comics/universal_install_script.png){: .image-process-article-photo}

which properly renders to:

<img alt="XKCD #1654" class="image-process-article-photo" src="https://imgs.xkcd.com/comics/universal_install_script.png"/>

My pelicanconf.py look like this:

SITEURL = "http://localhost:8000"

PLUGINS = [
    (...)
    "pelican_image_process",
]

IMAGE_PROCESS = {
    "article-photo": {
        "type": "responsive-image",
        "sizes": """
            (min-width: 1200px) 800px,
            (min-width: 992px) 650px,
            (min-width: 768px) 718px,
            100vw
        """,
        "srcset": [
            # All keeps 4:3 aspect ratios.
            ("600w", ["scale_in 600 450 True"]),
            ("800w", ["scale_in 800 600 True"]),
            ("1600w", ["scale_in 1600 1200 True"]),
        ],
        # Default Plumage's central content column is 540px wide, so default to
        # 600w variant.
        "default": "600w",
    },
}
(...)
@kdeldycke kdeldycke added the bug label Nov 27, 2020
@kdeldycke kdeldycke changed the title External images not filtered out External images are not filtered out Nov 27, 2020
@kdeldycke
Copy link
Member Author

For the record, I managed to bypass this issue with a hack in my theme, in which I inspect the URL from the src attribute: kdeldycke/plumage@d99098d#diff-73faed5a2803d28b38722b6addaebddb6e3517605ce03deaf65cd312a8f79049R53-R56

It does the job for now. Maybe we can apply that fix into image-process directly. The thing is, I looked at the code to try to add that fix but I felt like the plugin is in needs of a little refactor... 😔

@MinchinWeb
Copy link
Member

@kdeldycke Was this solved by PR #51, included in the v2.1.3 release?

@patrickfournier
Copy link
Collaborator

Fixed by #51

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

No branches or pull requests

3 participants