Skip to content

Picturefill.WP plugin approach #1

Open
@kylereicks

Description

In the spirit of sharing.

With the WordPress plugin Picturefill.WP, I took the approach of using srcset and sizes rather than the picture element, along the lines of this use case. The default settings for srcset is to include the thumbnail, medium, large, and full image sizes if they are available. The sizes setting by default is set to (max-width: {image size width}) 100vw, {image size width}, with the "image size width" taken from the image that was added to the editor.

Imitating some of WordPress' other features, srcset and sizes attributes can be set via register functions. This keeps much of the responsibility for responsive images at the theme level.

Even without the picture element, WordPress' image editing tools allow some minimal art direction. The thumbnail can be given different treatment from the rest of the images. More control of the editor would open up more possibilities for art direction.

I am interested to hear other ideas on this. Thanks very much to @Wilto for opening up a place for conversation.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions