Closed (outdated)
Project:
D7 Media
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
2 Nov 2015 at 01:44 UTC
Updated:
28 Jan 2019 at 03:08 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kaidjohnson commentedThere is likely a better way to do this, but since other validation criteria are included in the actual database query for images, I figured this would be the place to start.
Comment #3
kaidjohnson commentedWhoops, bad formatting. Updated.
Comment #6
kaidjohnson commentedThird time's a charm! It would be great if I made the patch from the project repo and not my site repo...
Comment #7
kaidjohnson commentedComment #8
_Geertje commentedHello kaidjohnson
Your patch works really good! The 'library' tab in the media browser shows - indeed - only the images with the allowed min/max resolutions.
But I noticed another issue:
At filtering those images (with the exposed filters on top of the view, for example; to filter at name) the restrictions are lost again. The filter is correctly applied (when I searched 'flower', an image with title 'flower' is indeed shown) but i can also search on (and select) images which are bigger or smaller than the min/max resolution.
Maybe it has something to do with the fact that it is not applied trough ajax, but i don't know. I searched in the media module, but i could not find anything yet. I hope you or someone else can help me a bit with this?
(I am new here, so maybe this is not the right place to ask this question; please then tell me where to put it.)
Thanks in advance!
Geertje
Comment #9
kaidjohnson commentedHi Geertje, thanks for the feedback! I'm surprised that the filter queries don't run through the same query flow as the initial, unfiltered query. I'm going to be doing a chunk of work over the weekend that will likely touch this area of a project I'm working on and will take a look to see what might be going on.
-Kai
Comment #10
_Geertje commentedComment #11
Jeroen_005 commentedAll,
I applied a fix for _Geertje's issue, but it's quite dirty. Maybe someone haves a better solution for it.
Also I fixed an incorrect join in the patch from comment #6. It was joining the field_usage table so files that weren't used in a node where not loaded in the library.
Jeroen
Comment #13
Jeroen_005 commentedComment #14
nico.knaepen commentedFor testing we've prepared the following:
Then we've tested the following use cases:
Min and max resolutions empty
Set min resolution to 50x50
Set max resolution to 100x100
It looks like the max resolution check is not working.
Maybe the link can help to continue testing:
Simplytest (valid untill 15/03/16 11:30 +2)
Comment #15
Jeroen_005 commentedThanks for the review Nico.
There was a typo in an if statement.
Your issue should be solved in this patch.
Comment #16
nico.knaepen commentedThe newest patch fixed the issue.
Thnx for the quick reaction.
Comment #17
josephdpurcell commentedThis is a nice patch! Thank you for submitting this.
Any idea if this will get contributed? It's a small changeset that provides good value.
Comment #18
betz commentedCould this patch be committed please?
i am still patching media module with each update, for 2 years now.
Comment #19
joseph.olstadKaare what is your opinion on this patch?
Comment #20
kaareI haven't tested this, but considering the life-span of this and @nico.knaepen's review and its follow-up fix, I assume it works as expected. Only a couple nits regarding the actual code:
My instant reaction was tthat "why do string manipulation in SQL", but this is the only way to do it during query. And both
CAST()andREPLACE()is supported by all major databases so this is good.$formisn't initialized, and further down it might be sent todrupal_render() as such. This should be initialized as empty.Add a test around this, e.g
if (!empty($form)).I haven't investigated deeply if this is the only way to extend this form. No way to hook into the form using any
*form_alter()tricks? The solution seems hacky, but I'm fine with this if no other solution exists.So overall it's almost good, but I think this should go to the 3.x branch.
Comment #21
kaareComment #22
joseph.olstadok, moving to the 3.x branch
Comment #23
kaareComment #24
chris matthews commentedRecent versions of media have resolved most of peoples concerns and is compatible with entity translation, multilingual and various advanced configurations. Due to the high volume of inactive and most often irrelevant issues we are Closing this as (outdated). If for whatever reason this issue is important to you AND you still have issues after checking the media recipe documentation, then let us know and we will review your concerns.
Otherwise, see the recipe documentation for how to configure media and for troubleshooting tips OR refer to the media_dev distribution if you want to see a working media setup.
As mentioned, feel free to make some noise in this issue if you still feel it is important to you or someone else.
Thanks,
Media team