Problem/Motivation

Before a user uploads an image, if there is a maximum dimension set, the help text reads, for example:
"Images must be smaller than 100x100 pixels." This confuses the user since the image can be automatically resized to accommodate these limits. We therefore replace it with, "Images larger than 100x100 pixels will be resized."

Before the patch

Proposed resolution

Alter the text to be more accurate.

Also, see issues #16 through #33 suggesting that checking for the presence of an image toolkit should not be necessary, as a D8 installation without a toolkit is an edge case, and therefore a condition that is practically impossible to trigger.

After the patch in #31

Remaining tasks

Backport it to D7. Note that D7 version should have consideration for !ImageToolkit::isAvailable() (or functional D7 equivalent)

Contributor tasks needed
Task Novice task? Contributor instructions Complete?
Create a patch Instructions Yes
Embed before and after screenshots in the issue summary Novice Instructions Yes
Backport the Changes to an Earlier Version of Drupal Core Novice Instructions

User interface changes

Changes user interface text to read: "Images larger than !max pixels will be resized".

Similar changes to the case where both a minimum and maximum resolution are specified.

The message about *minimum* dimensions (only) is not changed.

API changes

String is used in file file.field.inc line 931.
if/else block says:

- if there's a toolkit, resize the image
- else, just reject it for being too large.

See #847098: Revise image field min/max settings help text form for clarity.

Original report by fietserwin

Should read something like "Images larger than !max pixels will be resized". For the exact choice of text perhaps have a look at #311159: Inaccurate/misleading user text. String is used in file file.field.inc line 931.

CommentFileSizeAuthor
#149 inaccurate_txt.patch991 byteshi_ten_ja
#149 interdiff_inaccurate_txt.txt991 byteshi_ten_ja
#145 evidence2.png17.34 KBAlgarte
#145 evidence1.png15.54 KBAlgarte
#144 core-more_accurate_image_upload_text-1079116-144.patch2.57 KBjenlampton
#142 core-more_accurate_image_upload_text-1079116-142.patch2.79 KBjenlampton
#140 core-more_accurate_image_upload_text-1079116-140.patch2.64 KBDavid_Rothstein
#135 Beforepatch_134.png44.88 KBmahalingam_cs
#135 Afetrpatch_134.png120.78 KBmahalingam_cs
#134 core-more_accurate_image_upload_text-1079116-134.patch2.64 KBmanishmittal9
#130 core-more_accurate_image_upload_text-1079116-130.patch2.47 KBGribnif
#128 core-more_accurate_image_upload_text-1079116-128.patch2.64 KBGribnif
#127 core-more_accurate_image_upload_text-1079116-127.patch2.53 KBjenlampton
#118 core-more_accurate_image_upload_text-1079116-118.patch1.53 KBlomasr
#112 core-more_accurate_image_upload_text-1079116-112.patch2.49 KBstefan.r
#110 core-more_accurate_image_upload_text-1079116-110.patch2.55 KBjenlampton
#103 1079116-103.patch2.17 KBsnehi
#103 interdiff-1079116-98-103.txt1.04 KBsnehi
#98 1079116.98.drupal.more_accurate_image_upload_text_fixed.patch2.05 KBwebservant316
#97 1079116.97.drupal.more_accurate_image_upload_text.patch2.09 KBmgifford
#52 1079116.52.drupal.more_accurate_image_upload_text.patch2.19 KBMatt V.
#42 1079116.42.drupal.more_accurate_image_upload_text.patch2.28 KBfearlsgroove
#41 1079116.41.drupal.more_accurate_image_upload_text.patch2.27 KBfearlsgroove
#38 1079116.38.drupal.more_accurate_image_upload_text.patch1.2 KBfearlsgroove
#34 after.png43.11 KBBiigNiick
#34 before.png44.8 KBBiigNiick
#31 1079116.31.drupal.more_accurate_image_upload_text.patch669 bytesfearlsgroove
#17 1079116.17.drupal.more_accurate_image_upload_text.patch577 bytesjoachim
#12 imgcapture.jpg71.17 KBHappyJiyoung
#9 311159-more_accurate_image_upload_text-9.patch998 bytesryan.gibson
#6 311159-more_accurate_image_upload_text-5.patch990 bytesryan.gibson
#3 311159-more_accurate_image_upload_text-3.patch988 bytesryan.gibson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fietserwin’s picture

Version: 8.x-dev » 7.0
Assigned: HappyJiyoung » Unassigned
Status: Needs work » Active
Issue tags: -Novice

Hmmm, string 'Images must be between !min and !max pixels.' (line 925, same file) has the same issue of being misleading.

dddave’s picture

Version: 7.0 » 8.x-dev

Due to the string change I suspect this has to be done in D8.

ryan.gibson’s picture

Status: Active » Needs review
FileSize
988 bytes

So, I agree that the current text is misleading. Although, I also understand that resizing images on upload will cause the loss of EXIF data in the image; we don't want users to be confused or misled.

If an image field has a 100px by 100px max resolution. The text should not be "Images must be smaller than 100x100 pixels." I think "Images must not be larger than 100x100 pixels." sounds better and is more accurate.

The patch changes it to this:

"Images must not be smaller than !min pixels."

and

Images must not be larger than !max pixels.

Those are my thoughts anyway.

Status: Needs review » Needs work

The last submitted patch, 311159-more_accurate_image_upload_text-3.patch, failed testing.

ryan.gibson’s picture

Assigned: Unassigned » ryan.gibson
Status: Needs work » Needs review

Oops, this patch should work.

ryan.gibson’s picture

And the actual patch would be helpful...

ar-jan’s picture

But the original issue was that you can upload images larger than e.g. 100x100 - they'll be resized, so the user doesn't need to do this before uploading. So this is still misleading.

ryan.gibson’s picture

Well, resizing the image during upload causes loss of EXIF data, using image styles in the content display is the best way to handle resizing images. We could include that warning on the upload text as well, but I think it would be better to include in the help instructions optionally.

ryan.gibson’s picture

I actually agree, the OP's text is more accurate. Changed that in the patch.

ryan.gibson’s picture

Assigned: ryan.gibson » Unassigned

Unassigning myself - I thought there might be more people who were also confused by this text.

ryan.gibson’s picture

Issue tags: +Novice

tagging novice for review.

HappyJiyoung’s picture

Assigned: Unassigned » HappyJiyoung
Status: Needs review » Needs work
FileSize
71.17 KB

imgcapture.jpg
I tried to see if your patch worked but it doesn't show your latest description. I think your description was good to go!

Or me and other two mentors guessed where this description should appear. We guessed on image resize when we create article content or something. Is this right area to check your patch?

fietserwin’s picture

Version: 7.0 » 8.x-dev
Assigned: Unassigned » HappyJiyoung
Status: Active » Needs work
Issue tags: +Novice

If the loss of EXIF data is an unwanted side effect, then this might be put in the warning as well? Something like: Images larger than !max pixels will be resized, thereby possibly loosing its EXIF data. Or is this over the top for most usages?

Note 1: I normally prefer to have EXIF data removed to decrease image file size. So I guess "normally" this is desired behavior.
Note 2: I used "possibly" in the text as there are image formats that don't have EXIF data to start with or there may be image toolkiits that keep the EXIF data.

Devin Carlson’s picture

joachim’s picture

+++ b/core/modules/file/file.field.inc
@@ -960,10 +960,10 @@ function theme_file_upload_help($variables) {
+      $descriptions[] = t('Images smaller than !min pixels will be resized.', array('!min' => '<strong>' . $min . '</strong>'));

The above disagrees with what my D7 image field says:

> The minimum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Leave blank for no restriction. If a smaller image is uploaded, it will be rejected.

and also D8:

> 114: '#description' => t('The minimum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Leave blank for no restriction. If a smaller image is uploaded, it will be rejected.'),

As for the matter of EXIF data, that's out of the scope of this issue. It's also ripe opportunity for bikeshedding, as I for one reckon that it's overkill and will potentially scare and confuse users who don't know what EXIF is, but just see they are being told that BAD THINGS MIGHT HAPPEN. So let's leave that out of this patch.

joachim’s picture

Furthermore, we still need to logic seen in #311159: Inaccurate/misleading user text, as http://api.drupal.org/api/drupal/core!modules!file!file.module/function/... demonstrates there are two pathways for an image that is too large:

      if (image_get_toolkit()) {
        return t('Images larger than @max_size pixels will be scaled', array('@max_size' => $max_size));
      }
      else {
        return t('Images must be smaller than @max_size pixels', array('@max_size' => $max_size));
      }
joachim’s picture

Assigned: HappyJiyoung » Unassigned
Status: Needs work » Needs review
Issue tags: +Needs backport to D7
FileSize
577 bytes

Here's a new patch, using image_get_toolkit() to determine whether or not to show the message.

Compare with http://api.drupal.org/api/drupal/core!modules!file!file.module/function/..., which only scales if a toolkit is present, and just rejects images that are too small rather than upscale them.

Rather than add a condition in every min/max combination, I've added the message about scaling on its own line, which seems like the simplest thing.

That should also mean we can backport it to D7, since it adds a string rather than changes existing ones.

Status: Needs review » Needs work

The last submitted patch, 1079116.17.drupal.more_accurate_image_upload_text.patch, failed testing.

joachim’s picture

Really not sure how an extra UI text can cause a failing test in Locale module...

fietserwin’s picture

Status: Needs work » Needs review

Me neither, so let's try again

fietserwin’s picture

Status: Needs review » Needs work
Issue tags: +Novice, +Needs backport to D7

The last submitted patch, 1079116.17.drupal.more_accurate_image_upload_text.patch, failed testing.

fietserwin’s picture

#16: Looking at the actual code (file_validate_image_resolution in file core\modules\file\file.module), I can't see the logic described.

- If there is no toolkit (checked via image_get_info), the validator will let the file pass through without issuing an error nor warning.
- If (one of the ) the dimensions are(/is) too large, the file will be loaded and scaled.
- If the file won't load, an error 'The image is too large; the maximum dimensions are %dimensions pixels.' will be issued.
- Otherwise the warning 'The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.' will be issued.

#17: I don't like that we first say to the user that images may be max ... pixels and, on the next line, say that larger images will be resized: that will confuse users. So we should just replace that message as we can safely ignore the case in which there is no active image toolkit (is this even possible without getting loads of warnings and other error messages on image fields?).

#15: images are (currently in both D8 and D7) not upscaled if they fall below the minimum dimensions, So you observation is right and that message (about minimum dimensions) should not be changed

#15: I agree with your remark about EXIF data: leave it out.

I still don't get the test failure, but it is back to needs work anyway now.

joachim’s picture

> - If there is no toolkit (checked via image_get_info), the validator will let the file pass through without issuing an error nor warning.

I think you've misread the code:

        // Try to resize the image to fit the dimensions.
        if ($image = image_load($file->uri)) {
          image_scale($image, $width, $height);
          image_save($image);
          $file->filesize = $image->info['file_size'];
          drupal_set_message(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $maximum_dimensions)));
        }
        else {
          $errors[] = t('The image is too large; the maximum dimensions are %dimensions pixels.', array('%dimensions' => $maximum_dimensions));
        }
      }

This if/else block says:

- if there's a toolkit, resize the image
- else, just reject it for being too large.

fietserwin’s picture

Nope, the image_get_info already checks for the toolkit:

  if ($info = image_get_info($file->uri)) {
    if ($maximum_dimensions) {
      ...
      if ($info['width'] > $width || $info['height'] > $height) {
        if ($image = image_load($file->uri)) {
          ...
        }
        else {
          ...
        }
      }
    }

    if ($minimum_dimensions) {
          ...
    }
  }
joachim’s picture

Oh, you're right.

In which case, what circumstances lead to this failing and the else{} being triggered?

        if ($image = image_load($file->uri)) {
fietserwin’s picture

#26: Good question. Seems hardly possilbe. GD can read image dimensions but fails on opening it and placing it in a resource. This can typically be caused by an out of memory error, but that fails with a fatal in PHP and does not return control back to the PHP code. So that message can be kind of ignored I guessed.

RobW’s picture

Referencing #847098: Revise image field min/max settings help text form for clarity, especially my comment in #10. Should that thread be marked as a duplicate and the ideas brought over here?

joachim’s picture

That issue is about the admin UI, this is about the entity edit form.

While I definitely think both issues should work in tandem, bigger patches are harder to review and work on and get committed, and in this case the patches are already fairly complex. Hence I suggest they remain separate.

RobW’s picture

Sounds good.

techmsi’s picture

Issue summary: View changes

Summarized issue

fietserwin’s picture

Issue summary: View changes

Changed link into "issue link"

fearlsgroove’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
669 bytes

Updated UI message to match text provided in issue summary

webchick’s picture

fearlsgroove and I talked about this patch.

hook_image_requirements() does still have a conditional that allows you to have an image toolkit or not, so it is at least theoretically possible to have D8 without an image toolkit. However, he and I tried several times without success to obliterate Drupal's knowledge of an active image toolkit and each time the image was nevertheless resized when uploading.

So while I was originally suggesting a conditional ("If there's a toolkit, talk about image resizing, else do nothing") we couldn't actually trigger the condition, so I think unconditionally changing it is probably fine. OTOH, fearlsgroove is now determined to figure out how to trigger a null, so... stay tuned! ;)

mondrake’s picture

@webchick, @fearlsgroove re #32, the GD Toolkit is part of the system module, so IMHO practically it is not possible to have D8 currently without at least an active toolkit.

More info in #2110835: Move the GD toolkit on its own module, and #2122605: Remove isAvailable() from ImageToolkitInterface - they may be worth a review :)

BiigNiick’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
44.8 KB
43.11 KB

the patch seems to work on my end as it is, but webchick pointed out other issues...

Before

After

BiigNiick’s picture

Status: Reviewed & tested by the community » Needs review
fearlsgroove’s picture

I've been able to verify the same .. Drupal crashes spectacularly when there is no toolkit available when trying to resize an image that meets the conditions described here. I've created a follow up to update hook_requirements.

brents’s picture

Assigned: Unassigned » brents

I am working on a review.

fearlsgroove’s picture

Thanks @manarth, updated patch handles the case when there is a min and a max resolution.

Status: Needs review » Needs work

The last submitted patch, 38: 1079116.38.drupal.more_accurate_image_upload_text.patch, failed testing.

BMDan’s picture

fearlsgroove’s picture

Status: Needs work » Needs review
FileSize
2.27 KB

Fix failing test. Also missing a "pixels" for consistency.

fearlsgroove’s picture

The last submitted patch, 41: 1079116.41.drupal.more_accurate_image_upload_text.patch, failed testing.

droppinshucks’s picture

I just applied the patch https://drupal.org/files/issues/1079116.42.drupal.more_accurate_image_up... and it is working in the UI (and appears to pass testing).

katherined’s picture

Issue summary: View changes

Embedded screenshots, and corrected and clarified description of problem and proposed solution.

katherined’s picture

Issue summary: View changes

Added reference to the discussion of a potential absence of an image toolkit, and the conclusion that it is a non-issue.

manarth’s picture

Status: Needs review » Reviewed & tested by the community

RTBC.

I've reviewed the patch in comment 42 - it's a minimal change and the testcase has also been updated.
I've also verified that the patch applies, and the new text appears in the UI, matching the screenshots.

Following up comments 32/33, the GD extension is a required extension (enforced in system_requirements) so we can rely on having at least one image-manipulation extension available. I'll follow that up in #2281471.

webchick’s picture

Version: 8.x-dev » 7.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed to 8.x. Great work everyone! :D

BMDan’s picture

Issue summary: View changes
fietserwin’s picture

Should this be backported? We are talking UI text changes only.

BMDan’s picture

Should this be backported? We are talking UI text changes only.

Certainly not strictly needed, no. But then again, isn't that why we have "Minor" as an available priority? This is not high-effort, but it's fairly high-reward in terms of UX.

Matt V.’s picture

Status: Patch (to be ported) » Needs review
FileSize
2.19 KB

Here's a quick backport.

fietserwin’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Matt V.’s picture

Status: Needs work » Needs review
Matt V.’s picture

Status: Needs review » Reviewed & tested by the community

It appears the test failure was a false alarm, so I'm switching the status back to RTBC.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Matt V.’s picture

Status: Needs work » Needs review
Matt V.’s picture

Status: Needs review » Reviewed & tested by the community

The test failures seem to keep happening intermittently with fatal error in different places during the retests, but the same tests pass fine on simplytest.me and when I manually queue the patch for retesting here.

Is the automated testing running into some sort of resource constraint or something?

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

mgifford’s picture

Issue tags: +Needs reroll

Status: Needs work » Needs review
dcam’s picture

Issue tags: -Needs reroll

The patch still applies, so it doesn't need a reroll. It's just experiencing the random test failures that have been plaguing us lately.

Matt V.’s picture

Status: Needs review » Reviewed & tested by the community

Unfortunately, when the random failures happen, they also change the status from RTBC to Needs Review. I'm setting it back, based on fietserwin's review in comment #53. All the test failures since then appear to have been the random failures that dcam described.

mgifford’s picture

Sorry about adding the "Needs reroll " tag. I swear it failed when I tried to apply it on SimplyTest.me earlier in the day..

Thanks for marking it RTBC again @Matt V.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review
dcam’s picture

Status: Needs review » Reviewed & tested by the community
webservant316’s picture

#52 works for me. Thanks. Hope this patch can be pushed to D7 so I don't have to maintain it locally :-)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 52: 1079116.52.drupal.more_accurate_image_upload_text.patch, failed testing.

Status: Needs work » Needs review
Matt V.’s picture

Status: Needs review » Reviewed & tested by the community

As noted above, the intermittent test failures are false positives. I'm updated the status to set it back to RTBC.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review

The code in file_validate_image_resolution() considers the possibility that an image cannot be resized and I believe it's possible for that to occur... although I suppose it's enough of an edge case that the help text shouldn't cater to it.

However, to the extent that these are user-facing strings, we don't want to change them except to fix a major/critical problem (https://www.drupal.org/node/1527558). In reality, this one is somewhere between a user-facing and admin-facing string...

The text visible at the top of the patch file ("Images must be exactly !size pixels") probably needs to be changed too?

Would it be too radical of a suggestion to just remove the strings entirely, rather than breaking translations? In other words, what if we just said "Images must be larger than !min pixels" and ignored the max pixels setting in the default help text entirely? Will the average user even care beforehand that their image is going to be resized? (They will still see the message after they upload saying that it was successfully resized.)

BMDan’s picture

Issue tags: -Novice

Killing the "novice" tag.

@David, agreed, this might be one of those "perfect is the enemy of the good" situations. I think if we can get something backported, given how terribad the UX is now, that's better than the status quo. Even if the "something", in this case, is to remove some of the messages.

To put it another way: sure, fine, whatever. Can we please just do something, though!?

I'd argue that D7 isn't exactly backwater and that it deserves a full fix, but I'd be happy with anything that improves this silly situation at this point. Doing a partial fix and then iterating on it in a separate issue (if necessary) is as good an approach as any other, really.

mgifford’s picture

Assigned: brents » Unassigned

@brents happy for a review still, things have changed a bit.

@David_Rothstein remove the strings entirely would probably satisfy the 80% goal. I'm fine with that approach.

webservant316’s picture

I just upgraded to Drupal 7.36 and had to re-apply this patch.
Any chance of getting this patch applied to core?

webservant316’s picture

Me again...

I just upgraded to Drupal 7.37 and had to re-apply patch #52.
Any chance of getting this patch applied to core?

mgifford’s picture

There's nothing to RTBC yet @webservant316

@David raised a critical point with translation strings in #92.

I don't think this really does the trick, as I don't know how to get rid of 'Images larger than !max pixels will be resized.'

I'm also not certain that by just "ignored the max pixels setting" that it would make it that much easier for translation.

That said I wrapped up this new patch as it would be really sweet to get this in.

webservant316’s picture

!max removed from the substitution array to clean up the patch.

yes, sweet to get this in!

mgifford’s picture

Ya, no need for , '!max' => '<strong>' . $max . '</strong>')); I should have caught that.

Gribnif’s picture

One thing that everyone seems to have missed in this entire discussion is that there is still a semantic error in the text of one of these help strings, and the proposed patch is duplicating it.

The string currently reads, "Images must be larger than !min pixels," which is not consistent with the way validation occurs. It should read, "Images must be at least !min pixels."

cilefen’s picture

Issue tags: +Novice

I am tagging this "Novice" because a novice can read this issue and make progress on it.

snehi’s picture

Assigned: Unassigned » snehi

Status: Needs review » Needs work

The last submitted patch, 103: 1079116-103.patch, failed testing.

The last submitted patch, 103: 1079116-103.patch, failed testing.

snehi’s picture

Assigned: snehi » Unassigned

Status: Needs work » Needs review

snehi queued 103: 1079116-103.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 103: 1079116-103.patch, failed testing.

David_Rothstein’s picture

Priority: Minor » Normal

I committed part of this at #2563403: Description text for image dimension settings unclear but then rolled it back because based on discussion here it was incomplete.

Would be great to get this moving again and fixed... if we really have to break translations we can, but I'd still like to find a way to do it without that if possible.

We probably need a followup issue to change "Images must be exactly !size pixels" in Drupal 8 as well (assuming my comment in #92 was correct).

jenlampton’s picture

Here's a reroll that fixes the line recommended by @David Rothstein back in #92.

Status: Needs review » Needs work

The last submitted patch, 110: core-more_accurate_image_upload_text-1079116-110.patch, failed testing.

stefan.r’s picture

Status: Needs work » Needs review
FileSize
2.49 KB

reroll

  • webchick committed c993e0d on 8.3.x
    Issue #1079116 by fearlsgroove, joachim, ryanissamson, manarth,...

  • webchick committed c993e0d on 8.3.x
    Issue #1079116 by fearlsgroove, joachim, ryanissamson, manarth,...
jenlampton’s picture

Status: Needs review » Reviewed & tested by the community

Patch works great, still applies to 7.52

tstoeckler’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/modules/file/file.field.inc
@@ -956,16 +956,16 @@ function theme_file_upload_help($variables) {
     if ($min && $max && $min == $max) {
-      $descriptions[] = t('Images must be exactly !size pixels.', array('!size' => '<strong>' . $max . '</strong>'));
+      $descriptions[] = t('Images larger than !size pixels will be resized.', array('!size' => '<strong>' . $max . '</strong>'));

Shouldn't this also have the "Images must be larger than !size pixels." sentence. As it is now the "min" part of the condition is kind of swept under the rug, no?

David_Rothstein’s picture

Status: Needs review » Needs work

Yes, you're right.

Also as I mentioned above that line needs to be changed in Drupal 8 too, so we need a separate issue for it anyway.

lomasr’s picture

lomasr’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 118: core-more_accurate_image_upload_text-1079116-118.patch, failed testing.

MaskyS’s picture

Status: Needs work » Needs review
denutkarsh’s picture

Status: Needs review » Reviewed & tested by the community

Tested it on drupal 7.x and it looks good to me.

  • webchick committed c993e0d on 8.4.x
    Issue #1079116 by fearlsgroove, joachim, ryanissamson, manarth,...

  • webchick committed c993e0d on 8.4.x
    Issue #1079116 by fearlsgroove, joachim, ryanissamson, manarth,...
David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work

The automated test failures above look real to me. Why did the latest patch remove the test changes that the earlier patch had?

David_Rothstein’s picture

-      $descriptions[] = t('Images must be exactly !size pixels.', array('!size' => '<strong>' . $max . '</strong>'));
+      $descriptions[] = t('Images must be larger than !size pixels. Images larger than !size pixels will be resized.', array('!size' => '<strong>' . $max . '</strong>'));

This wording also looks very repetitive to me. It should not be necessary to repeat "larger than !size pixels" twice.

And again, as discussed above, this part still needs to be fixed for Drupal 8 too. So in my opinion, let's just move it to a separate issue and take it out of the current patch. It can be discussed elsewhere rather than holding this issue up.

jenlampton’s picture

Status: Needs work » Reviewed & tested by the community
FileSize
2.53 KB

This wording also looks very repetitive to me. It should not be necessary to repeat "larger than !size pixels" twice.

It's not repetitive, one is the minimum, the other is the maximum. It only looks repetitive since you are seeing !size instead of the two different sizes.

The attached patch is the change from #118 with the test change from #112 added. Marking as RTBC since it was before (hope that's okay?)

Gribnif’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.64 KB

After all this discussion, the wording of the messages for the minimum size in the most recent patch is still semantically incorrect and, therefore, confusing. If a minimum of "10x10" is set, this means the size must be >= 10x10, not > 10x10 as the current wording implies.

Occurrences of "larger than" should actually be "at least", i.e.: Images must be at least !size pixels. See the attached patch. Changing back to Needs Review.

Status: Needs review » Needs work

The last submitted patch, 128: core-more_accurate_image_upload_text-1079116-128.patch, failed testing.

Gribnif’s picture

himanshu-dixit’s picture

Status: Needs work » Needs review

Setting to NR.

Status: Needs review » Needs work

The last submitted patch, 130: core-more_accurate_image_upload_text-1079116-130.patch, failed testing.

manishmittal9’s picture

Testing the patch in #130 in Drupal-7.x, failed to apply

manishmittal9’s picture

Status: Needs work » Needs review
FileSize
2.64 KB

reroll

mahalingam_cs’s picture

FileSize
120.78 KB
44.88 KB

Patch from #134 applied successfully. Attached the screenshot before and after patch screen. The wording for the message looks good.

mahalingam_cs’s picture

Status: Needs review » Reviewed & tested by the community
jenlampton’s picture

+1 on RTBC. Nice work everyone :)

stefan.r’s picture

Issue summary: View changes
Issue tags: +Pending Drupal 7 commit
David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: -Pending Drupal 7 commit +needs forward port to Drupal 8
-      $descriptions[] = t('Images must be exactly !size pixels.', array('!size' => '<strong>' . $max . '</strong>'));
+      $descriptions[] = t('Images must be !size pixels. Images larger than !size pixels will be resized.', array('!size' => '<strong>' . $max . '</strong>'));

This (from the patch in #134) doesn't make sense. The second sentence completely contradicts the first.

The patch in #128 looks good to me though, so a direct reroll of that so it applies again might be OK.

***

After all this discussion, the wording of the messages for the minimum size in the most recent patch is still semantically incorrect and, therefore, confusing. If a minimum of "10x10" is set, this means the size must be >= 10x10, not > 10x10 as the current wording implies.

Occurrences of "larger than" should actually be "at least",

Excellent point :) It is a separate bug than what was fixed here for Drupal 8 though. Normally we'd just backport the same bug that was fixed in Drupal 8 and that's it. However, I agree with fixing it all at once here for Drupal 7 so as not to break translations more times than necessary.

But we still need a Drupal 8 issue and a patch for Drupal 8 that makes the same fixes there.

***

This wording also looks very repetitive to me. It should not be necessary to repeat "larger than !size pixels" twice.

It's not repetitive, one is the minimum, the other is the maximum. It only looks repetitive since you are seeing !size instead of the two different sizes.

No, in the case I'm talking about the size is repeated also. For example, with the patch from #118 the wording is like this:

Images must be larger than 200x150 pixels. Images larger than 200x150 pixels will be resized.

And with the newer patch in #128, it's like this:

Images must be at least 200x150 pixels. Images larger than 200x150 pixels will be resized.

However, I guess what bothered me about that in the first place was less the repetition of the numbers themselves, but rather the repetition of the whole phrase - because it does not make sense for the first sentence to say "images must be X" and then for the second sentence to essentially say "if images are X, Y will happen" because it is a useless conditional given that X already has to be true. However, with the revised text in #128, that's no longer an issue, so I think I'm happy with the final wording :)

David_Rothstein’s picture

Status: Needs work » Needs review
Issue tags: +Drupal 7.60 target
FileSize
2.64 KB

Here's a direct reroll of #128, without the changes that were introduced in #134.

This still needs a Drupal 8 issue/patch though.

David_Rothstein’s picture

     if ($min && $max && $min == $max) {
-      $descriptions[] = t('Images must be exactly !size pixels.', array('!size' => '<strong>' . $max . '</strong>'));
+      $descriptions[] = t('Images must be at least !size pixels. Images larger than !size pixels will be resized.', array('!size' => '<strong>' . $max . '</strong>'));
     }
     elseif ($min && $max) {
-      $descriptions[] = t('Images must be between !min and !max pixels.', array('!min' => '<strong>' . $min . '</strong>', '!max' => '<strong>' . $max . '</strong>'));
+      $descriptions[] = t('Images must be at least !min pixels. Images larger than !max pixels will be resized.', array('!min' => '<strong>' . $min . '</strong>', '!max' => '<strong>' . $max . '</strong>'));
     }

Note: These two sentences are exactly the same in practice. So to save translators a bit of work, we could probably just remove the first one entirely and just use the second whenever if ($min && $max) is true.

jenlampton’s picture

I'm happy with the wording in #128, and the patch in #140 is working for me. Trying one more revision to address the comment in #141.

Status: Needs review » Needs work
Algarte’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
15.54 KB
17.34 KB

Tested patch #144 and the new message works fine for me. The wording seems good and understandable.

See images attached below with a before and after the patch:

Before :
Before

After :
After

jenlampton’s picture

Patch still applies cleanly to 7.56.

jenlampton’s picture

Patch still applies cleanly to 7.57.

jenlampton’s picture

Patch still applies cleanly to 7.58

jenlampton’s picture

I'm not sure why there is another patch in #149. @hiten2112 can you please explain your changes?

Patch in #144 still applies cleanly to Drupal 7.59, and is RTBC.

joseph.olstad’s picture

Issue tags: -needs forward port to Drupal 8, -Drupal 7.60 target +Drupal 7.61 target

Bumping to 7.61. This didn't make it into 7.60

jenlampton’s picture

Looks like it didn't make it into 7.61 either.
Patch in #144 still applies cleanly to Drupal 7.61, and is RTBC.

izmeez’s picture

I'm not entirely sure but looking at the patches in #144 and #149 the difference appears to be related to whether or not images less than the minimum are resized or only those that are larger than the max are resized.

joseph.olstad’s picture

jenlampton’s picture

Looks like it didn't make it into 7.62 either.

Patch in #144 still applies cleanly to Drupal 7.63.

jenlampton’s picture

Issue tags: -Drupal 7.64 target +Drupal 7.65 target

Looks like it didn't make it into 7.64 either.

Patch in #144 still applies cleanly to Drupal 7.64.

jenlampton’s picture

I reviewed he patch in #149, and in that patch the text 'will be resized' to the message about minimum dimension. That statement is not accurate (or grammatically correct). The patch in #144 is still our best option here.

Since this didn't make it into 7.65 either, resetting tag.

Patch in #144 still applies cleanly to Drupal 7.66.

izmeez’s picture

@jenlampton Thanks for the update. The patch in #144 has been RTBC for 2 years, it would be nice to see it committed.

jenlampton’s picture

Patch in #144 still applies cleanly to Drupal 7.67.

Chris Matthews’s picture

Issue tags: -Drupal 7.65 target +Drupal 7.68 target
joseph.olstad’s picture

joseph.olstad’s picture

Maintain the RTBC
1) Has tests
2) To increase our confidence in the test results for the above issue, these two should go in first so we can re-queue php 7.3 and php 5.3 tests.
#3047844: [Regression] Tests fail on PHP 5.3
#3025335: session_id() cannot be changed after session is started

MustangGB’s picture

Issue tags: -Drupal 7.68 target +Drupal 7.69 target
jenlampton’s picture

Thanks for the update @joseph.olstad!
Patch in #144 still applies cleanly to Drupal 7.68 and 7.69.

MustangGB’s picture

Issue tags: -Drupal 7.69 target +Drupal 7.70 target

jenlampton’s picture

Patch in #144 still applies cleanly to 7.70, 7.71, and 7.72.

izmeez’s picture

Issue tags: -Drupal 7.70 target +Drupal 7.72 target

Patch in #144 is now 3 years old today. Will be nice to see it committed. Thanks.

jenlampton’s picture

Issue tags: -Drupal 7.72 target +Drupal 7.74 target

Patch in #144 still applies cleanly to 7.73. Updating target to 7.74.

izmeez’s picture

Yes, confirmed patch still applies and is RTBC and in 6 months we will hit the 10 year mark! Why are things like this so slow with Drupal?

jenlampton’s picture

Patch in #144 still applies to 7.74. Updating target.

jenlampton’s picture

Patch in #144 still applies to 7.75. Updating target.

izmeez’s picture

Was added to #3179845: [meta] Priorities for 2020-12-02 bugfix release of Drupal 7.76 / 7.77 on weekend to raise it's visibility, did not make the cut for next release this week but might in 3 months.

jenlampton’s picture

Thanks for the update @izmeez! Patch in #144 still applies to 7.77. Updating target.

jenlampton’s picture

Patch in #144 still applies to 7.78. Updating target.

ressa’s picture

Thanks for verifying that the patch still applies @jenlampton. This issue is included in #3192080: [meta] Priorities for 2021-04-07 release of Drupal 7, so tagging with "Drupal 7.xx target" probably isn't necessary any longer ... Remaining issues will be transferred to a new meta issue for the next planned D7 release.

Let's try using meta issues to list the priority issues for upcoming bugfix / maintenance releases of D7.

Using the e.g. "Drupal 7.74 target" tags frequently gets messed up by security releases, and it's generally harder to keep track.

From #3179845: [meta] Priorities for 2020-12-02 bugfix release of Drupal 7.76 / 7.77

mcdruid’s picture

Issue tags: -Novice, -Drupal 7.79 target +Pending Drupal 7 commit

#144 LGTM

mcdruid’s picture

Issue tags: +Needs change record

Discussed this with @Fabianx and the only concern is that it's a string change so translations will be affected.

Checked with gábor-hojtsy and there's nothing we can do about that other than mention it in a CR.

Added a tag for that, but this (specifically #144) is good to go apart from that.

joseph.olstad’s picture

Once this is committed, the updated strings translations can be updated but not before.

  • mcdruid committed 78d98c8 on 7.x
    Issue #1079116 by jenlampton, fearlsgroove, ryan.gibson, Gribnif, snehi...
mcdruid’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Pending Drupal 7 commit, -Needs change record

Committed to 7.x - thanks for your perseverance everyone!

I added a simple CR for string changes / translations.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

izmeez’s picture

What about the string translations? Do these now need a new patch and a new issue?

joseph.olstad’s picture

@izmeez , you can add the translations here: https://localize.drupal.org/translate