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

Some way of specifying different image options for index vs. entry #184

fluffy-critter opened this issue Mar 16, 2019 · 1 comment · Fixed by #191


Copy link

commented Mar 16, 2019

Expected Behavior

It would be nice if there were a way to specify different image rendition and set options for an image based on the template that's rendering it. For example, on an image gallery, setting the count/offset differently on index vs. entry (without it being global to the template), or having cropping only happen on index.

Possible Solution

Similar to how there's fullsize_* variants of many of the image parameters, maybe there could also be {template}_* variants (e.g. index_crop=(1,2,3,4)).

Plumbing through the template name would be tricky and issue-prone, though, so maybe it would be better to have the template itself provide e.g. entry.body(_prefix='index_'), which would then have e.g. index_crop take precedence over crop. So then like in markdown.HtmlRenderer._render_image, when it computes composite_args it can do something like

prefix = composite_args.get('_prefix')
if prefix:
    for k,v in composite_args:
        if k.startswith(prefix):
            composite_args[k[len(prefix):]] = v

and do the same when computing container_args in HtmlRenderer.image or whatever.


Want to do different thumbnail/gallery/etc. layouts for index vs. entry pages on my art site, and different cropping for thumbnails vs. detail pages on just as two simple examples

@fluffy-critter fluffy-critter added this to the 0.4 milestone Mar 19, 2019


This comment has been minimized.

Copy link
Collaborator Author

commented Apr 3, 2019

This also needs to support HTML entries. It's probably appropriate to add the necessary functionality to image.parse_image_spec which would need to take in the config dict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.