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

Adds a square-crop option to automatically crop images #568

Closed
wants to merge 4 commits into from
Closed

Adds a square-crop option to automatically crop images #568

wants to merge 4 commits into from

Conversation

benjamin-hull
Copy link
Collaborator

This option adds a wrapper element and some basic styling to crop images to a square, regardless of the original orientation. This should work in most simple cases, but there definitely will be some layouts it's not suitable for. It's really designed to handle the common case where users just drop in the script and point it at their username.

The starting point was this discussion: #527 and the fact that the workarounds no longer work, now that Instagram rejects unsigned URLs.

The new option is off by default, so everything should be backwards-compatible.

Lastly, this is my first foray into CoffeeScript, so let me know if I've got the style wrong or done anything dumb anywhere!

@stevenschobert
Copy link
Owner

Hey @benjamin-hull! Thank you for the contribution!

I've been super busy with other projects, but I'm really happy you took the time to put up the code here. I took a really brief glance at it, and everything looks good. The documentation additions is super helpful, so thanks for that.

Since it's a new feature, I'll probably end up pulling this into a v1.5 release, rather than v1.4.2, so I'll probably revert that commit (no worries though!).

I'll try to get this into a release as soon as I can, thanks!

@benjamin-hull
Copy link
Collaborator Author

benjamin-hull commented Mar 29, 2018

No problem, mate. I've probably used your code on a dozen sites now, so it's the least I could do, really. Plus, forced me to look at CoffeeScript finally too, so that's a bonus.

It's almost a shame to have to include the feature detection, styling and DOM manipulation stuff for a workaround like this - it's obviously much cleaner without it, but judging by the discussion on the issues, I get the feeling that a lot of users are beginners when it comes to CSS and JS.

Makes much more sense as a 1.5 now that I think about it, too.

Thanks again for a great little lib! Let me know if I can ever help with anything else.

@jackputtock
Copy link

Hello; Steven, Benjamin,
What is the estimate for the release of 1.5? This feature would be awesome on my site as some of my recent Instagram images were not in the same aspect ratio or size as the rest causing it to push / mess up scaling.

Jack.

@joeygallegos
Copy link

I am having the same issue and this would help a whole lot. Do we have an ETA on the next major release for instafeed?

@benjamin-hull
Copy link
Collaborator Author

Hey @joeygallegos and @jackputtock - sorry for the delay. I know Steven's been up to his eyeballs on other projects, so as far as I know there's no timeline for the next release. Likely it will contain more than just this fix, though.

In the meantime, it's easy enough to achieve this yourself using the template options in instafeed.js, plus some simple CSS. I've got an example of that here: https://codepen.io/benjamin-hull/pen/xWprYe

If you have trouble with the CSS, feel free to leave a comment on the CodePen example, that way others can find it, too.

Thanks!

@stale
Copy link

stale bot commented Sep 18, 2018

This issue has been automatically marked as stale because it hasn't had new comments in the last 3 months. It will be closed if no further activity occurs. If you still need assistance with this issue, or believe it shouldn't be closed, please respond with a new comment to let us know.
Thank you all for your contributions.

@stale stale bot added the stale Issues that have been inactive for 90 days or more label Sep 18, 2018
@stale stale bot closed this Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues that have been inactive for 90 days or more
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants