Scale Mode - #17
Conversation
There was a problem hiding this comment.
The deprecated behavior corresponds to fit, I believe.
rafikk
commented
Oct 21, 2014
A couple of high-level comments:
|
artnez
commented
Oct 21, 2014
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. |
artnez
commented
Oct 21, 2014
(but feel free to review those anyway so I can make changes when I work on halfshell again) |
rafikk
commented
Oct 30, 2014
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. |
artnez
commented
Oct 30, 2014
Busy week. Planning on picking it up on again on Fri. |
artnez
commented
Nov 1, 2014
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 |
artnez
commented
Nov 1, 2014
The reason why |
artnez
commented
Nov 1, 2014
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. |
There was a problem hiding this comment.
I really don't like using implicit named return values. Can you leave this line as is?
artnez
commented
Nov 2, 2014
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 |
artnez
commented
Nov 3, 2014
Gonna take a little time remove the implicit returns. I'll rebase everything into a couple commits when it's done. |
rafikk
commented
Nov 3, 2014
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
artnez
commented
Nov 5, 2014
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. |
artnez
commented
Nov 8, 2014
ping, should be ready to merge. |
rafikk
commented
Nov 11, 2014
Sorry for sitting on this. Looks great. The only question I have is whether |
artnez
commented
Nov 11, 2014
Doesn't |
rafikk
commented
Nov 11, 2014
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 |
artnez
commented
Nov 11, 2014
Aha. You're right! Adding all 3 should be trivial so I'll do that. I like |
rafikk
commented
Nov 11, 2014
Go for it! |
artnez
commented
Nov 12, 2014
Ready to go with docs. |
rafikk
commented
Nov 13, 2014
Awesome, dude. I'm excited about this. I'm going to take a stab at the |
artnez
commented
Nov 13, 2014
Baller. I'll refactor the other PRs on top of this refactor. |
No description provided.