Problem/Motivation
I have an image field with a minimal resolution bigger than 600x600. When i use Devel Generate to create default content. The generated images resolution are smaller than the defined minimals in the field.
Steps to reproduce
1. Create a content type with a minimal resolution of 800x800 ( any resolution bigger than 600x600 works to reproduce the bug).
2. Run devel generate to create content of that content type.
Proposed resolution
The generateSampleValue method should check if the minimal resolution is bigger than 600x600, and redefine the max_resolution value accordingly.
Remaining tasks
Add tests, see #12
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
Please review the provided patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | image_generatesample_patch_and_test.patch | 3.59 KB | guiu.rocafort.ferrer |
| #11 | with_patch.png | 390.41 KB | roberttabigue |
| #11 | without_patch.png | 361.13 KB | roberttabigue |
| #11 | image_field_config.png | 467.12 KB | roberttabigue |
| #7 | sample-2-with-patch.png | 111.38 KB | guiu.rocafort.ferrer |
Comments
Comment #2
rootworkTagging as novice.
Task: Apply the patch (ask mentors if you need help). See if it applies.
If it does apply: See if it does what it says it does and report back with screenshots.
If it does not apply: Report any error messages you get, and change the status to "Needs work".
Comment #3
andregp commentedThe previous patch had some Coding Standard errors.
Comment #4
andregp commentedI was either unable to reproduce the bug or the bug doesn't exists (maybe I just didn't follow the right steps).
I created a new content type with only one field (a required image field with min resolution of 600x600), then, without the patch code, ran Devel generate to create some content from this new content type I just made. All the images had the correct size.
Comment #5
andregp commentedChanging status as this issue already have a patch.
Comment #6
rootworkThanks @andregp! Untagging as novice as it sounds like more investigation needs to happen.
Comment #7
guiu.rocafort.ferrerHi, i will rephrase the steps to reproduce as they might not be as clear as i thought:
1. Create a content type with a minimal resolution of 800x800 ( any resolution bigger than 600x600 works to reproduce the bug).
2. Run devel generate to create content of that content type.
I attached some screenshots reproducing the bug and applying the patch.
Comment #8
andregp commentedThanks for the clarification @guiu.rocafort.ferrer!
Sending to Needs Review as we already have a patch with a possible solution and the Active status is used only when there's no patch attached (reference here).
Comment #9
andregp commentedAdding back Novice tag as it's a simple review.
Comment #11
roberttabigue commentedHello,
I applied Patch #3 and confirmed it works now.
Please see attached files.
Thank you.
Comment #12
quietone commentedCan we get some tests of this so there is no regression? There is an existing test \Drupal\Tests\image\Kernel\ImageItemTest that looks like it can be used. I am adding the "needs tests' tag.
Comment #14
quietone commentedThis still needs a test.
Comment #15
guiu.rocafort.ferrerThis patch file also adds a new test to check both the default case, and the bug issue.
Please review it.
Comment #16
guiu.rocafort.ferrerI am removing the needs test tag, also changing status to Needs review.
Comment #17
smustgrave commentedThanks for the tests. Just FYI for next time when adding tests it helps to upload a test-only patch followed by the full patch. Also an interdiff between patches.
But I ran the tests locally without the fix and it failed as expected
Failed asserting that 709 matches expected '800'.
Expected :800
Actual :709
Comment #18
larowlanCrediting @rootwork for mentoring, @quietone for a review and @smustgrave for running the test locally
Comment #21
larowlanCommitted 4578bbd and pushed to 11.x. Thanks!
Backported to 10.1.x. Not backporting any further because 9.5.x and 10.0.x are now in security only mode.
Fixed on commit (comment was > 80 chars).