Download & Extend

IMCE Search image preview

Project:IMCE Tools
Version:6.x-1.1
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

Replace lines 19 to 24 ...

/*$(li).click(function () {
  file = fullpath.substr(fullpath.lastIndexOf('/') + 1);
  dir = fullpath.substr(0, fullpath.lastIndexOf('/'));
  imce.dirActivate(dir);
  imce.highlight(file);
});*/

With :
$(li).click(function () {
  fullpath_split = fullpath.split('/');
  if(fullpath_split.length == 4)
    dir = '.';
  else
    dir = fullpath_split[fullpath_split.length - 2];
  file = fullpath_split[fullpath_split.length - 1];
  if(dir != imce.conf.dir)
    imce.navigate(dir);
  imce.highlight(file);
});

Comments

#1

Status:needs review» needs work

@appolonet - thank you for the patch, I've found the following issues and wondered if you might have some insight:

The navigation to the located directory only works for directories which are the initial descendent of the current directory. For example, if in directory A with a subdirectory of A/B/C then a file located in C is not displayed when selected. I've done some work to iterate and descend into the directories but there is an issue because each child must be loaded before continuing down the directory tree and there doesn't seem to be a way to hook into the loading processing to know when to continue.

#2

Status:needs work» needs review

Attached patch:

  • Displays search results as icons with thumbnail preview for images
  • Clickable search results - will navigate to selected file and highlight it
  • Disabled search in current directory - search in all files - to search only in current selected directory uncomment line 27 and comment line 28 in imce_search.module
  • Limit search results to 50 results - to remove limitation see line 39 in imce_search.module
AttachmentSize
imce_tools_search-preview-navigate-to-file-6.x.patch 8.37 KB

#3

@petrica.martinescu

Unfortunately it didn't apply clean here, so I generated a new diff for someone who has the same problem. To apply the patch, copy the file to the module root (/imce_tools), then use "patch -p1 < imce-search-preview-image-1216028-03.patch". Use "patch -p1 -R < imce-search-image-preview-1216028-03.patch" to revert.

It worked almost fine, except for a few issues:

  1. "data.files.length" is returning "undefined results found."
  2. Sometimes you click on the image and it navigates to it, sometimes not.
  3. Even making changes in line 27 and 28, the search continues returning results from subdirectories.

Despite these issues, I tested it with some users here and they liked it a lot.

Thank you for the patch!

IMCE search preview

AttachmentSize
imce-search-image-preview-1216028-03.patch 8.89 KB
nobody click here