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

add image helper for easier image insertion in posts #572

Closed
wants to merge 4 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@fa-ribeiro
Contributor

fa-ribeiro commented Oct 7, 2016

This PR adds an 'image' helper for easier insertion of image in posts (#560)

It handles both local images (it assumes images are under assets/images) and urls.

in order to add an image to a post, just use the following syntax:

{% include image image_path="2016/07/MyPostImage.png" caption="The optional image caption" %}

or

{% include image image_path="https://example.com/images/MyPostImage.png" caption="The optional image caption" alt="The optional alt text" %}

Parameters are:

  • image_path (mandatory): the image path. It can be an url or a local path. In the former case, it assumes images are under assets/images, so you only need to specify the path from there.
  • caption (optional): the image caption.
  • alt (optional): the alt text.

What you think?

@mmistakes

This comment has been minimized.

Show comment
Hide comment
@mmistakes

mmistakes Oct 8, 2016

Owner

Looks good and fits in well with the gallery helper. I'll see about merging this in when I do the next release of the theme. Currently working on a few things to make the switch over to a gemified version of the theme and I'd like to include this with that release.

Owner

mmistakes commented Oct 8, 2016

Looks good and fits in well with the gallery helper. I'll see about merging this in when I do the next release of the theme. Currently working on a few things to make the switch over to a gemified version of the theme and I'd like to include this with that release.

@mmistakes mmistakes added this to the 4.0 milestone Oct 8, 2016

Show outdated Hide outdated _includes/image
Show outdated Hide outdated _includes/image
@mmistakes

Care to make some minor edits to remove base_path and replace with the new absolute_url filter in Jekyll 3.3.0 so I can merge this PR?

@fa-ribeiro

This comment has been minimized.

Show comment
Hide comment
@fa-ribeiro

fa-ribeiro Nov 5, 2016

Contributor

done :-)

Contributor

fa-ribeiro commented Nov 5, 2016

done :-)

@mmistakes

Just one more small thing and should be good to go. Thanks!

Show outdated Hide outdated _includes/image
Do not assume images would be placed in `/assets/images/`
In order to add an image to a post, just use the following syntax:

{% include image image_path="/full/path/to/MyPostImage.png" caption="The optional image caption" %}

or

{% include image image_path="https://example.com/images/MyPostImage.png" caption="The optional image caption" alt="The optional alt text" %}
@mmistakes

This comment has been minimized.

Show comment
Hide comment
@mmistakes

mmistakes Nov 8, 2016

Owner

Looks like Jekyll core may get a native filter to do something similar. jekyll/jekyll#5560

Owner

mmistakes commented Nov 8, 2016

Looks like Jekyll core may get a native filter to do something similar. jekyll/jekyll#5560

@mmistakes mmistakes removed this from the 4.0 milestone Nov 15, 2016

@mmistakes

This comment has been minimized.

Show comment
Hide comment
@mmistakes

mmistakes Nov 15, 2016

Owner

I made a small change and renamed the helper from image to figure to be more semantic. The PR has been merged c4252b0 and will show up in the next theme release.

Thanks for your work on this.

Owner

mmistakes commented Nov 15, 2016

I made a small change and renamed the helper from image to figure to be more semantic. The PR has been merged c4252b0 and will show up in the next theme release.

Thanks for your work on this.

@mmistakes mmistakes closed this Nov 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment