Closed (fixed)
Project:
Media Bulk Upload
Version:
3.0.0
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
18 Sep 2019 at 07:49 UTC
Updated:
26 Apr 2023 at 07:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nick dewitte commentedComment #3
nick dewitte commentedComment #4
mrpauldriver commentedThank you for working on this.
After submission I am presented with two error messages and the image is not uploaded. At the end on the messages is the statement "The file filename.jpg with resolution 3586x1978 could not be uploaded. The resolution should be between x and 1920x1080"
Error One
Undefined offset: 1 in Drupal\media_bulk_upload\Form\MediaBulkUploadForm->validateImageResolution() (line 469 of modules/contrib/media_bulk_upload/src/Form/MediaBulkUploadForm.php).Error Two
Undefined offset: 1 in Drupal\media_bulk_upload\Form\MediaBulkUploadForm->validateImageResolution() (line 487 of modules/contrib/media_bulk_upload/src/Form/MediaBulkUploadForm.php).The full error message output can be found on pastebin.
Comment #5
nick dewitte commentedComment #6
nick dewitte commentedMinor improvements:
Comment #7
fonant commentedUpdated patch that applies to latest code.
Would be nice to apply the checks using the client side JavaScript too.
Comment #8
fonant commentedAnd another minor fix to change the size error messages to say "than" instead of "then".
Comment #9
fonant commentedComment #10
FanisTsiros commentedAs per #4 this does not work.
Logic here, is that images have to scale down to maximum allowed image size at image field settings.
Just comes with an error saying that "The file nz6_3733.jpg with resolution 6048x4024 could not be uploaded. The file should be smaller than 1600x1600"
Comment #11
nick dewitte commented#4 details a mistake in the error message.
This patch is intended to prevent users from uploading images larger than the maximum allowed size.
Before this patch, images where uploaded directly, even if their size was larger then the maximum size.
Comment #12
FanisTsiros commented@Nick Dewitte, oh yes, sorry about that. I just reviewed the patch code and i relize this was not what i expected.
What i was expected was an image dimensions resize message like this:
The image was resized to fit within the maximum allowed dimensions of 1600x1600 pixels. The new dimensions of the resized image are 1600x1065 pixelSeems that this is a core issue https://www.drupal.org/project/drupal/issues/3008292.
I am not sure if this patch here could be merged, so we have the functionality i wish.
Thank you for this module and your work!
Comment #13
vinaySreedhara commentedPatch looks good, but not adding the validation as it does check for type 'image' by using array key exists in the MediaType object so update the code to check the plugin id of the mediaType source.
Comment #14
rhristov commentedI am applying a new patch that is using the core image resolution validation and is resizing the image if needed.
Comment #15
ashu1629 commentedI am applying new patch to work with 3.0.0 version. Please review. It works fine for max image resolution, but does not show error message for minimum image resolution.
Comment #16
kristen polThis is a nice UX issue. Assigning to myself to try to get this into the next release.
Comment #17
kristen polFyi, for all the people who've added updated patches above, in the future, please include interdiffs so we know easily what has changed:
https://www.drupal.org/node/1488712
Comment #18
kristen polHere are crude raw diffs between the 4 patches.
Comment #19
kristen polQuick review of the last patch in #15. I haven't tested.
Nitpick: missing space before
throwNitpick: The media type.
Fix param type:
array=>FileNitpick: The file.
Comment #20
kristen polI'm going to fix this one and test it.
Comment #22
kristen polI tested and did some tweaks to the code. I found that it is fine for dealing with the max resolution but not the min which was noted above in #15. But this may be due to:
#2922667: Image fields minimum dimension restrictions don't apply equally in D7 and D8
so I'm going to let this slide for now. It does resize the image when it's too big which is nice.
Thanks, everyone!