Closed (cannot reproduce)
Project:
Drupal core
Version:
10.0.x-dev
Component:
file system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
12 Jul 2009 at 08:28 UTC
Updated:
18 Apr 2022 at 08:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
eojthebraveDefinitely needed.
Patch applies but with offset.
Comments changes/additions that are not completely necessary but are not harmful at all. Cleanup that is not essential to this patch though. I'm all for leaving them there, just wanted to make sure it was pointed out.
+ * (optional) A string in the form WIDTHxHEIGHT. This will check that the+ * (optional) A string in the form WIDTHxHEIGHT e.g. '640x480' or '85x85'. If+ // Clear the cached filesize and refresh the image information.These two lines will throw an exception if min or max dimension is 0, which is what it is set to by default.
Fixing that should fix at least some of the exceptions encountered by the testing bot.
Should this include a test for this new validation case? Make sure that an image that can not be resized to the appropriate dimensions is rejected.
Comment #3
drewish commentedIs that "(optional)" change based off some new standard for core? I've not seen it before and it doesn't match the rest of the file. If it's not a core initiative I'd leave it as it was.
I find these changes pretty confusing and hard to follow, not to mention untested. I wonder if it would be clearer to—as was discussed over on #353580: file_validate_image_resolution doesn't allow not resizing if a toolkit is present.—break this into two functions one for validating and one for resizing.
Comment #4
quicksketchRE: the "(optional)" change, I'm not sure if it's a "new" standard or not, but it seems like a lot of refactorings are using it, most notably nearly all of common.inc uses it, doing a search on core it's used around 70 times in core, which admittedly is probably not even close to all, but it might be more common than any other approach.
Adding new tests is definitely necessary, though I'm not really seeing much benefit in splitting into two functions, adding the $resize parameter should be able to accomplish the same thing as #353580: file_validate_image_resolution doesn't allow not resizing if a toolkit is present.. Eventually that parameter will map one-to-one with an option in ImageField, where an extra checkbox is simply added to the field configuration form for "Scale down oversize images" or similar.
Comment #5
rfayRelated: #27234: Maximum picture size help text in profile no longer needed
Comment #6
rooby commentedHere is an updated version of the patch for latest drupal 7.
It also has a couple of additions to stop errors when $minimum_dimensions or $maximum_dimensions is zero, which addresses #2.
I don't have time right now to do tests sorry.
It fixes my issue, which was that I couldn't restrict a field to specific dimensions by filling out min & max res fields with the same value. Before it would resize the image down, not complying with the min value but not failing validation.
Comment #7
rooby commentedHere is a drupal 8 version of the patch in #6.
It is a direct port and I have not actually tested it, I only tested the D7 one.
Comment #9
rooby commentedOops, here is a drupal 7 one to fix the exceptions.
The fails are due to the tests needing modification, but I'm going to bed instead of fixing those right now.
Comment #10
rooby commentedAnd the drupal 8 one.
Comment #11
rooby commentedTurns out I was wrong about the fails :)
Comment #12
micnap commentedPartial duplicate of http://drupal.org/node/1577554
Comment #13
cweagansFixing tags per http://drupal.org/node/1517250
Comment #14
thatjustin commentedPerhaps I don't understand the D7 workflow, but why hasn't this made it into D7? Can we make that happen? Should I open a new issue? I see that in #7 it was moved to D8, unclear to me why.
Comment #15
rooby commentedThe process is that if a bug also exists in drupal 8 it should be fixed there first, then once that happens the version will be set back to drupal 7 and it can be fixed there too.
There are patches for both drupal 8 & 7 though so hopefully this can be addressed.
To do that we need some patch reviews so if you can try out one or both of the patches and report back with the results that would help.
- Changing the owner seeing as quicksketch's last reply was in '09.
Comment #16
brettbirschbach commentedThe patches in #9 (drupal 7) and #10 (drupal 8) are code-wise identical. The only diffs are the actual line numbers. I successfully applied the drupal 8 patch in #10 to my drupal 7 instance, and things appear to be working correctly for me.
Comment #17
brettbirschbach commentedThis patch has been in place on my site since March 2013. Switching to "reveiwed & tested by community".
Comment #18
alexpottdrupal-file_validate_img_res-516790-10.patch no longer applies.
Comment #19
biro.botond commentedRe-rolled
Comment #21
mrded commentednew patch
Comment #23
mrded commentedComment #24
mrded commentedSorry, new version of patch which can be applied to latest 8.x core.
Comment #25
mrded commentedVersion for Drupal 7.
Comment #26
mrded commentedComment #28
dave reidComment #29
mrded commentedNew patch with tests.
Comment #30
dave reidSo the only thing I ask in return for RTBCing this patch, is that we file a follow-up to not use the Druplicon image in this test, and instead generate a test image on demand using Random::image() for a something more consistent for testing. Could you please file a follow-up issue for that?
Comment #31
alexpottThe test does not fail with only the changes to tests applied - therefore we don't proper test coverage.
Comment #33
gábor hojtsyFix media tag.
Comment #34
scotthorn commentedThis patch is a the same as #24 but for 8.1.x
Comment #44
quietone commentedI tested this on Drupal 10.0.x, standard install. I adjusted the min and max image sizes for the image in the article content type and then attempted to load an image that when scaled down would be too small. I tested with different images and sizes and received error messages when the image was too small.
Therefore, closing as cannot reproduce. If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").
Thanks!