file.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. File repository
  2. ===============
  3. .. figure:: images/file.jpg
  4. :height: 125
  5. :width: 180
  6. :align: right
  7. :alt: A file in an Elgg file repository
  8. A file in an Elgg file repository
  9. The file repository allows users to upload any kind of file. As with everything in an Elgg system, you can filter uploaded files by tag and restrict access so that they're only visible by the people you want them to be. Each file may also have comments attached to it.
  10. There are a number of different uses for this functionality
  11. Photo gallery
  12. -------------
  13. When a user uploads photographs or other pictures, they are automatically collated into an Elgg photo gallery that can be browsed through. Users can also see pictures that their friends have uploaded, or see pictures attached to a group. Clicking into an individual file shows a larger version of the photo.
  14. Podcasting
  15. ----------
  16. An Elgg file repository RSS feed automatically doubles as an RSS feed, so you can subscribe to new audio content using programs like iTunes. Using the ``zaudio`` plugin, supplied in the default Elgg package, MP3 audio files are also directly playable in the page.
  17. Special content
  18. ---------------
  19. It is possible for other plugins to add to the players available for different content types. It's possible for a plugin author to embed a viewer for Word documents, for example.
  20. Note for developers
  21. -------------------
  22. To add a special content type player, create a plugin with views of the form ``file/specialcontent/mime/type``. For example, to create a special viewer for Word documents, you would create a view called ``file/specialcontent/application/msword``, because ``application/msword`` is the MIME-type for Word documents.
  23. Within this view, the ``ElggEntity`` version of the file will be referenced as ``$vars['entity']``. Therefore, the URL of the downloadable file is:
  24. .. code:: php
  25. <?php echo $vars['url']; ?>action/file/download?file_guid=<?php echo $vars['entity']->getGUID(); ?>
  26. Using this, it should be possible to develop most types of embeddable viewers.