Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

Filebrowser options

edited February 2014 in Framework

I think I saw a list of filebrowser options somewhere, but I'm not finding it again. Can you point me in the right direction?

I want to use the multi-image dialog to let the user upload and delete images but not to change directory, so I want to omit the drop-down path selector.

Comments

  • That's only a partial list. I found the complete list, I believe. It's at line 209 of apps/filemanager/ js/jquery.filebrowser.js

    However, I don't see an option not to show the dropdown list. Is there one?

  • You're right, the docs are a bit out of date with the options. There isn't an option to hide the dropdown currently, although it looks like it won't be hard to add (and would be a useful option!), but for now you could also try hiding it via CSS:

    #filebrowser-dirs { display: none !important; }
    
  • Thanks, that'll work for now. I don't suppose there's a way to pass a list of the images to show, is there? It's a shared folder but I only want user to see files they uploaded. (I may need to rethink the architecture...)

  • It might be better to limit each user to their own folder. You could do something like this to section them out:

    $folder = 'files/photos/' . User::val ('id');
    if (! is_dir ($folder)) {
        mkdir ($folder);
    }
    
  • Yeah, that's better on the back end, but on the front end I'm showing all the images using the filemanager gallery. Can I pass a path like files/photos/*/ to the gallery?

  • How many images is it going to be showing roughly? There is an is_dir() check in filemanager/gallery, so it won't allow * in paths directly, but you could duplicate it to your own handler and customize it from there. The file list is fetched via glob() so a * could work with very little change.

    It can also accept a list of files themselves, so another solution would be to glob() the file list then pass it to filemanager/gallery like this:

    $files = glob ('files/photos/*/*.{jpg,jpeg,gif,png,JPG,JPEG,GIF,PNG}', GLOB_BRACE);
    $files = is_array ($files) ? $files : array ();
    echo $this->run ('filemanager/gallery', array ('files' => $files));
    
  • I'm not sure how many. Not too many though (less than 20, I think).

    I think I'll just glob the file list and pass it to the gallery. Thanks for the help!

  • I found I had to remove files/ from the beginning of each file before I called {! filemanager/gallery !} in my view, but otherwise it works great.

    Is there a next/previous slider function built into the gallery by any chance? screenshot

  • Ah yes, it assumes files/ isn't part of the file paths. I forget these things sometimes :P

    The built-in gallery doesn't have slider controls (the filemanager/slideshow handler does, but it's really just a single possible case of how someone might use the jQuery cycle plugin).

    For more complicated galleries or slideshows, your best bet is to use these as a starting point and extend from there.

  • Okey-dokey. Any suggestions on extending? Look for a library? The filemanager gallery is close to what I need; it just doesn't have the arrow buttons.

  • I would just duplicate the filemanager/gallery handler and view templates (most likely apps/filemanager/views/gallery/embedded.html), and add the previous/next links like this:

    https://gist.github.com/jbroadway/8922641

  • Holy sheet! You are fricking awesome, do you know that?

  • Haha sometimes it's easier to type what I'm thinking in code ;) Glad it helps!

Sign In or Register to comment.