After selecting same image multiple times from Image Browser, same image is shown multiple times. I find this big usability issue.
Possible solution would be to filter same images in views (same 'fid') or to change how module and filter works.
Maybe if u change:
[[wysiwyg_imageupload:a:]]
to:
[[wysiwyg_imageupload:a,b:]]
where a would be 'fid' - unique file id
and b - file revison settings (all imagecache, style and alignment options)
and then in Image browser show only fids

Comments

eugenmayer’s picture

Priority: Major » Minor

Well a big an major issue is really something else :)

As the iid relation table is used, there is way of having dublicates. How to get rid of those using views will be the task here

nbchip’s picture

Distinct feature set in Views is not doing its job, or i think its not...
Maybe there is need for some intervention in form of views_pre_view hook.

eugenmayer’s picture

views is missing this feature by default, yes.

nbchip’s picture

Actually it selects distinct but on wrong field
SELECT DISTINCT(iid) , should be SELECT DISTINCT(wysiwyg_imageupload_entity.fid)

When i rewrite SQL it works (DB is database name)

SELECT DISTINCT(wysiwyg_imageupload_entity.fid) FROM DB.wysiwyg_imageupload_entity wysiwyg_imageupload_entity  INNER JOIN DB.files files_wysiwyg_imageupload_entity ON wysiwyg_imageupload_entity.fid = files_wysiwyg_imageupload_entity.fid INNER JOIN DB.node node_wysiwyg_imageupload_entity ON wysiwyg_imageupload_entity.nid = node_wysiwyg_imageupload_entity.nid GROUP BY iid

I tihnk GROUP BY isnt necessary

Hope this helps somehow.

jasonlttl’s picture

I don't think this view should be returning distinct fids because it really seems geared to capture instances of an image's use. Rather, I think the problem is that the view pulls in all node revisions (all past uses of an image) when most of my users are only going to care about the current revisions. I'll try to take a look at this in a little more depth in the next few days and post whatever solution I come up with.

This is the sql of the browser view.

SELECT DISTINCT(iid)
FROM
    wysiwyg_imageupload_entity wysiwyg_imageupload_entity
    INNER JOIN files files_wysiwyg_imageupload_entity
        ON wysiwyg_imageupload_entity.fid = files_wysiwyg_imageupload_entity.fid
    INNER JOIN node node_wysiwyg_imageupload_entity
        ON wysiwyg_imageupload_entity.nid = node_wysiwyg_imageupload_entity.nid
GROUP BY iid

I think it needs to take into account the vid (how to do in views?) with something a little more like this.

SELECT DISTINCT(r.iid)
FROM
    wysiwyg_imageupload_entity wysiwyg_imageupload_entity
    INNER JOIN files files_wysiwyg_imageupload_entity
        ON wysiwyg_imageupload_entity.fid = files_wysiwyg_imageupload_entity.fid
    INNER JOIN node node_wysiwyg_imageupload_entity
        ON wysiwyg_imageupload_entity.nid = node_wysiwyg_imageupload_entity.nid
     INNER JOIN wysiwyg_imageupload_entity_revision r
         on r.vid = node_wysiwyg_imageupload_entity.vid
         and r.iid = wysiwyg_imageupload_entity.iid

GROUP BY iid

By the way, thanks for the work on this module. The examples for how to extend it are fantastic.

eugenmayer’s picture

Thanks Jason.

Its pretty sure that the query is the issue, just because of the joins and the base-table. I was not able to work on the module for longer time already, just to busy with other stuff. So if someone wants to help, just go forward

nbchip’s picture

I agree that it not useful to show past revision images, still i think there should be option to also show only one instance of same image.
Main use case is browsing for images for insert and seeing same images is pointless.

eugenmayer’s picture

I completely agree. Thats simply a bug :)

jasonlttl’s picture

Yeah, I agree with nbchip in #7 too. Initially I was only thinking about nodes and not comments (or blocks or panels widgets - currently unsupported).

I may take a look at both this and the blocks/panels issue within the next week or so. My guess is, if that one's going to be solved it will need to be solved first as the use of blocks or panels (or comments maybe) has implications with respect to what shows in the browser. IE, if blocks/panels are supported, the browser can't tie back to a node. I'll try and generate some patches in both issues and submit them for Eugen's review.

eugenmayer’s picture

Thats exactly the issue jason. Currently we only support nodes as entities ( vid / nid ) what enables us to work with permissions and access and all this.

The issue is, i did not design this "openly", means, that you cant add new entites by an API, we have to rewrite the db-scheme to use a relation for the entity. Then, we need to talk about how to work with permissions, so respect them if entities are nodes ( node access ) and ask, by using an API, what kind of "block" permissions there are. Yet, i guess blocks are then readable by all, though all images can be used, and so forth ( can be extended later ).