Skip to content
This repository has been archived by the owner on Aug 10, 2018. It is now read-only.

codem/DisplayAnything3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DisplayAnything 3

About

A file and image gallery module for Silverstripe 3.0+, forked from our own DisplayAnything for SS 2.4.5+.

  • Multiple file uploading in supported browsers (not Internet Explorer)
  • Drag and Drop file uploading in supported browsers - Chrome, Firefox, Safari (and maybe Opera)
  • Uses a mimetype map, not file extensions to determine an uploaded file type
  • Uses system settings for upload file size
  • XHR file uploading
  • 100% Flash Free - no plugin crashes or other futzing with incomprehensible errors!
  • Uses SS3.0 bundled jQuery
  • Documented, extendable class
  • $_REQUEST free zone
  • Currently uses Valum's File Uploader ( http://github.com/valums/file-uploader ). Porting to jQuery Uploader is on the horizon.

This module is only compatible with the Silverstripe 3.0 release.

The module in action - A CMS view of a gallery associated with a page.

State

We've tested the module on various sites both internal and external and are happy with the performance. We're considering it a release candidate at the moment. Check the Issues area for known bugs.

If you would like to contribute to the development of this module, please fork it, hack away and then open a pull request.

If you would like to use a spiffy multi-file uploader and gallery module in SilverStripe 2.4.x, please look at DisplayAnything. Note that development of the v2 module will only include security updates.

Changes

  • Refactored gallery field
  • Gallery field no longer extends GridField, it's just a FormField
  • Pass the gallery relation in when creating field
  • Works with Strict Standards in PHP 5.4+
  • Move gallery methods to the gallery class & field related methods to the field class
  • Removed Image Gallery migration handlers as that module is not used in SS3

Upgrading

Previous versions were considered beta with API changes possible. We've changed the calling method for creating the gallery field and have removed or combined certain files.

  1. As with all SS module upgrades - sign in as admin *before* upgrading
  2. Replace display_anything with the most recent release
  3. Update the gallery field creation. Look at the examples directory for examples.
  4. Run /dev/build to rebuild the site manifest
  5. Run /?flush=1 to rebuild the site template cache
  6. Browse to your page or dataobject containing the gallery

We recommend updating this on your staging site then moving all changes live in a single update.

File & Directory Permissions

The gallery module ships with the following permissions (for *nix):

  • File: 0640 - user read/write, group read, other - no permissions
  • Directory: 0750 - user read/write/execute, group read/execute, other - no permissions

These permissions should work just fine for most setups.

Some shared server setups require more relaxed permissions. If you have find broken file thumbs, you can configure permissions as follows in your site _config.php file:

DisplayAnythingGallery::SetPermissions(0644, 0755)

We recommend against allowing world writable permissions, for obvious reasons.

TODO

  • We'd like the edit handler to open in a CMS panel, not a dialog. If you'd like to try and implement this, go for it.
  • Translations
  • Insert usual Internet Explorer line here. Note: we haven't looked at performance in less than IE9.
  • In PHP 5.4+, Transliterator::Create() is being called without a required argument by the SS Core, we have turned this off for now
  • If you're a Windows Server user, it would be great if you can chip in and provide some feedback/changes and pull requests. Your name/org will go on the credits.

Blame/Praise/Annotate ?

If you find a bug we'd like to know about it. If you like the module, spread the word on the internets!

  1. Please use the Github issue tracker
  2. Please provide the browser name and version
  3. Provide a description of what is happening so that we can reproduce any issues fast.
  4. Links to any examples of the issues that are occurring are very helpful

Installing

  1. Download and install SilverStripe 3.0
  2. cd /path/to/your/silverstripe/site
  3. Grab the source:
    Git
    git clone [email protected]:codem/DisplayAnything3.git display_anything
    Bzr (requires bzr-git) - note the / in the path
    bzr branch git://[email protected]/codem/DisplayAnything3.git display_anything
    Download
    wget --output-document=display_anything.zip https://github.com/codem/DisplayAnything3/zipball/master

    In all cases the module source code should be located in a directory called 'display_anything'
  4. run /dev/build (admin privileges required) to rebuild the site manifest
  5. Run /?flush=1 to rebuild the site template cache
  6. implement in the CMS - see the 'examples' directory in the source
  7. log into the CMS and start editing

CMS implementation

View the example directory for some sample page, dataobject and template implementations.

Templates

Innumerable gallery plugins with varying licenses exist for image & file lists and viewing of images in a lightbox (Fancybox is good and open source).

By design, DisplayAnything avoids being a kitchen sink, stays light and does not bundle any of these plugins. It's up to you to implement the gallery the way you want it (this saves you having to undo & override any defaults DisplayAnything may set).

View the example directory for some sample layouts related to the pages in the examples section.

Ordered Gallery Items

You can implement ordered galleries in your frontend template to match yours or someone else's drag and drop admin work on the Gallery. Simply change "GalleryItems" to "OrderedGalleryItems" in the template.

Watermarking

To implement watermarking, use the following image template/html snippet within your gallery control:

<li class="$EvenOdd $FirstLast"><a href="$URL" rel="page-gallery">$WatermarkCroppedImage(90,90)</a></li>

You can use any Silverstripe image resizing method supported (SetHeight, SetWidth, CroppedImage, PaddedImage, SetSize) but prefixed with "Watermark".

The module ships with a watermark image called "_wm.png". To implement your own, add an image called "_wm.png" to a directory named the same as your theme. For example, if your theme is "green", add a file of that name to document_root/green/images/.

Watermarking is only enabled if you use the Watermark prefixed template controls.

Watermark configuration options

Use the following in your site config:

  • WatermarkedImage::$opacity (0-100)
  • WatermarkedImage::$position (tr, tl, br, bl). Example br anchors the watermark image to the bottom right of the source image.
  • WatermarkedImage::$padding_x (pixel padding from image edge in the x-axis)
  • WatermarkedImage::$padding_y (pixel padding from image edge in the y-axis)

Watermark notes

  • Uses GD
  • 8 bit PNGs only
  • The watermark source image is not resized
  • The original image is not watermarked, only the thumbs created with "Watermark_METHODNAME_()" get watermarked
  • WatermarkedImageExtension is an extension to Image

Licenses

DisplayAnything is licensed under the Modified BSD License (refer license.txt)

This library links to Ajax Upload (http://valums.com/ajax-upload/) which is released under the GNU GPL and GNU LGPL 2 or later licenses

  • DisplayAnything is linking to Ajax Upload as described in Section 6 of the LGPL2.1 (http://www.gnu.org/licenses/lgpl-2.1.html)
  • You may modify DisplayAnything under the terms described in license.txt
  • The Copyright holder of DisplayAnything is Codem
  • The Copyright holder of Ajax Upload is Andrew Valums
  • Refer to javascript/file-uploader/license.txt for further information regarding Ajax Upload

About

File and image gallery module for SilverStripe3.0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •