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

Added missing GetCropUrl overload for MediaWithCrops #11201

Merged
merged 4 commits into from
Oct 10, 2021
Merged

Added missing GetCropUrl overload for MediaWithCrops #11201

merged 4 commits into from
Oct 10, 2021

Conversation

lauraneto
Copy link
Contributor

@lauraneto lauraneto commented Sep 27, 2021

The missing overload would mean that if anyone tried to use the extra options with MediaWithCrops, they would be using the IPublishedContent extension method instead.
This would cause several issues, like not loading the local crops and returning null for a lot of scenarios that should work.

Prerequisites

  • I have added steps to test this contribution in the description below

Description

Without this change the following line of code wouldn't work properly:

MediaWithCrops image = ...;
string localCropAlias = ...;
image.GetCropUrl(cropAlias: localCropAlias, useCropDimensions: true, imageCropMode: ImageCropMode.Crop, quality: quality, urlMode: urlMode);

Kept the same structure as the already existing overloads for consistency sake.

…onfiguration options

The missing overload would mean that if anyone tried to use the extra options with MediaWithCrops, they would be using the IPublishedContent extension method instead.
This would cause several issues, like not loading the local crops and returning null for a lot of scenarios that should work.
@umbrabot
Copy link

umbrabot commented Sep 27, 2021

Hi there @lauraneto, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@mikecp
Copy link
Contributor

mikecp commented Oct 9, 2021

Hi @lauraneto ,

Thanks a lot for this PR! It's a nice catch 👍
If I can make a suggestion, I think it would be nice if you could add the comments on top of the method like it is done for the other overloads, so that our documentation/intellisense remains homogeneous 😁

Also, before I can merge it, I would need you to target the v9/contrib branch, and not the v9/dev branch which is targeted for HQ developers. So, it would be great if you could make that adaptation!

Thanks again and sorry for this little delay.

@lauraneto lauraneto changed the base branch from v9/dev to v9/contrib October 9, 2021 07:21
@lauraneto
Copy link
Contributor Author

@mikecp Updated!
Also noticed that some other crop methods were also missing documentation, so created a new PR for that. #11335
Let me know if this one still needs any changes! 🙂

@mikecp
Copy link
Contributor

mikecp commented Oct 10, 2021

Thanks for the update @lauraneto! This PR is ready to be merged now 😁👍

I took the liberty of making one small additional change, in order to use the extension method on the mediaWithCrops parameter instead of calling it as a static method on the extension class. I hope this will be OK for you.

And I'll have a look at your other PR right after!

@mikecp mikecp merged commit 15aa713 into umbraco:v9/contrib Oct 10, 2021
@nul800sebastiaan nul800sebastiaan added the category/dx Developer experience label Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants