-
Notifications
You must be signed in to change notification settings - Fork 37
Scale Mode #17
Scale Mode #17
Conversation
halfshell/config.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deprecated behavior corresponds to fit, I believe.
|
A couple of high-level comments:
|
Agreed. I'll re-think the naming and update this PR. Don't approve the PRs depending on this one for now. I'll need to rebase those once this one is merged.
Good idea. First it would apply scale, then apply crop. |
|
(but feel free to review those anyway so I can make changes when I work on halfshell again) |
|
I don't want to lose momentum on merging these changes in. Let me know if you want me to help take on any of these changes. |
|
Busy week. Planning on picking it up on again on Fri. |
|
I'll do some more testing tomorrow. In the meantime here's a summary of the refactor with justification behind each major change.
You'll see a lot of switching to
Instead of implementing all of the ContentMode interface you pointed out, I just implemented the scale part. The focalpoint parameter (in a separate PR) handles positioning the image within the crop region. Took a couple functions out of the |
|
The reason why |
|
Ok I think it's ready to go. If it looks good to you I'll update the remaining PRs to cleanly merge on top of this one. |
halfshell/image.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't like using implicit named return values. Can you leave this line as is?
|
Thanks I'll will make the fixes today. Bummer about implicit returns, but I understand. Are you good with the renaming/removal of the *Wand functions? Long term I'm thinking about moving image transforms to a |
|
Gonna take a little time remove the implicit returns. I'll rebase everything into a couple commits when it's done. |
|
I'm having trouble tracking it down, but there's a Q&A session with the Go team where Rob Pike says including implicit returns in Go was "probably" a mistake. I'm definitely in favor of removing the Along those same lines, what do you think about changing |
- Replace NewImageFromHTTPResponse with NewImageFromBuffer - Check for errors instead of nil image structs - Image struct wrapper with helper methods
|
Rebased and squashed into a few commits.
I remember watching that too. I think it was Griesemer that said it. The official stance is use it if it makes things better and don't if it doesn't. It's never tripped me personally so I like it. I don't feel strongly enough either way so I removed it. Consistency is better anyway.
Agreed (for the future though). We can move the image processing functions (blur, etc) into the new image struct for imagick. The image processor simply defines processing strategy based on request parameters (blur + resize + crop). And the image actually applies them. |
|
ping, should be ready to merge. |
|
Sorry for sitting on this. Looks great. The only question I have is whether |
|
Doesn't |
|
No, it doesn't. As an example, let's say we have an image that's 500x800 pixels and I request an image that's 400x400. If it's set to We're missing the second behavior right now. I can definitely see a case for why you would want that. I'm fine with punting it to another release, but I'm afraid of using the |
|
Aha. You're right! Adding all 3 should be trivial so I'll do that. I like |
|
Go for it! |
|
Ready to go with docs. |
|
Awesome, dude. I'm excited about this. I'm going to take a stab at the |
|
Baller. I'll refactor the other PRs on top of this refactor. |
No description provided.