DisplayAnything
DisplayAnything is a gallery tool for SilverStripe CMS. It's primary goal is to replace the ImageGallery module as a file management tool for pages and dataobjects. It can also be used to manage galleries of other files such as PDF document lists.
- Handles file uploads via XHR or standard uploads.
- Security: uses a configurable mimetype map, not file extensions, to determine an uploaded file type
- Integration: uses PHP system settings for upload file size
- Multiple file uploading in supported browsers (Note: not yet supported by Internet Explorer)
- Drag and Drop in supported browsers (Chrome, Firefox, Safari and possibly Opera)
- XHR file uploading
- Has Zero Dependencies on the third-party Silverstripe modules ImageGallery, DataObjectManager and Uploadify
- 100% Flash Free - no plugin crashes, HTTP errors, I/O errors or other futzing with incomprehensible Flash errors!
- Import ImageGallery album items to a gallery
- Uses jQuery bundled with SilverStripe
- Well documented & clean code with extendable classes and overrideable methods
- $_REQUEST not used
- Uses Valum's Ajax Uploader (hat tip)
- Drag and drop sorting of images & files in the gallery
- File upload progress with cancel option
Source and Download
Source is located on Github, please review the readme.md file there for up-to-date instructions and changes. The module is currently considered beta quality and we are aiming to tag an initial 0.1 release by February 2012.
Use Cases
- Image gallery - allows asynchronous multiple uploads (if the browser supports it)
- File gallery - providing a document list associated with a given page or DataObject
- Single file or image - in a has_one scenario, DisplayAnything defers to it's underlying library UploadAnything to provide a single file upload field. Note that Silverstripe's core FileField and FileIframeField provide much the same functionality
- Video gallery - a sample extension of DisplayAnything is bundled to provide an example of a YouTube gallery. Each gallery item contains an image and an optional YouTube video URL and configuration area.
DisplayAnything is extensible using core SilverStripe programming techniques and does not rely on third party modules such as DataObjectManager or Uploadify.
Simple Gallery Example
To create a gallery associated with your Page model, you'll first need to add a gallery to the database schema. It's worth noting that this code is an example only so don't copy and paste it.
class SimpleGalleryPage extends Page {
// this page has one gallery
public static $has_one = array(
'SimpleImageGallery' => 'DisplayAnythingGallery',
);
}
You will then need to associate this field with the CMS interface for that page:
class SimpleGalleryPage extends Page {
// this page has one gallery
public static $has_one = array(
'SimpleImageGallery' => 'DisplayAnythingGallery',
);
public function getCmsFields() {
$fields = parent::getCmsFields();
$gallery = new DisplayAnythingGalleryField(
$this,
'SimpleImageGallery',
'DisplayAnythingGallery'
);
//where your files will be uploaded (e.g assets/gallery in this case)
$gallery->SetTargetLocation('gallery');
//add the field to a tab called 'Gallery', you can change the name if you want
$fields->addFieldsToTab('Root.Content.Gallery', array($gallery));
// other field declarations you may have
return $fields;
}
}
Once that is done, /dev/build your database (you must be logged in as an admin). Browsing to the page in the CMS you should see a 'Gallery' tab containing sub-tabs allowing you to configure each gallery. By default the gallery is set up to handle image uploads of GIF, PNG and JPG types.
Troubleshooting
If you run into trouble, try the following
- Ensure you are using the latest code from the source repo (either bleeding edge or a tagged branch)
- Put Silverstripe into dev mode ( Director::set_environment_type('dev'); ) in order to get verbose errors
- Read the Issues list at Github, it may contain discussion of a similar bug
- For upload errors, read the alert messages provided and ensure the assets directory is writable by the applicable system user and/or group
- Ensure the module is in a directory called "display_anything" in your SilverStripe install
If you are still having trouble with setup, please log an issue describing the problem. Provide code examples and links to pages if possible. Be descriptive of the issue and include what you were trying to do during setup. The more information, the faster the issue resolution.
Frontend templates
Inumerable gallery plugins with varying licenses exist for image & file lists and viewing of images in a lightbox (Fancybox is good and open source). DisplayAnything stays light and does not bundle any of these galleries. 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).
The readme.md file contains a simple example you can expand on for your frontend templates.
Gallery Usage
Display Anything allows you to configure galleries for different usages. 2 usages are bundled with the code "Image" and "Document". To edit or add these usages as instructed on the "Usage" tab of the gallery.
DisplayAnything uses mimetypes rather than file extensions to determine if a file can be uploaded. If you are unsure about the correct mimetypes, a good start is Google.
Management
The gallery tab allows you to manage:
- Uploading of new files, either in batches (Chrome, Firefox, Safari) or in single file mode (Internet Explorer <= 9)
- Reloading of the current file list
- The sort order of each item (drag and drop each item)
- Image deletion - hit the delete button
- Editing - click an image/file to open the editable fields in popup
- File replacement - in edit mode, choose File Preview and the standard file button to replace the file
Post your comment
Comments
-
I am thankful that I noticed this weblog, just the right info that I was looking for!
Posted by pizza hut coupons, 21/02/2012 9:38am (1 day ago)
-
Line 80: display.js
remove the trailing ', '
to stop error from occurring under IE9 (9.0.8112.16421)Posted by Simon A., 20/02/2012 5:10am (3 days ago)
-
Get thousands of visitors on daily basis.Our links building methods will bring huge traffic for your websites and ranked you top in Search engine results.Email us at: info@linkbuilding.pk
Posted by Backlinks, 17/02/2012 3:25pm (5 days ago)
-
purchase <a href=http://www.rolexoutletsale.com/>rolex watches price</a> for less
Posted by ZefSeine, 16/02/2012 8:00pm (6 days ago)
-
Feb23 Highly dhtlgeied with the necklace just as described very eye-catching Have already bought other items.Would certainly recommend a browse through the website.
Posted by Paul, 16/02/2012 3:27pm (6 days ago)
-
Just a smiling visitant here to share the love (:, btw outstanding style. "Better by far you should forget and smile than that you should remember and be sad." by Christina Georgina Rossetti.
Posted by pearly penile papules removal at home, 13/02/2012 10:10am (9 days ago)
-
The charm beans tend to be magical or perhaps rhodium or precious metal plated with http://www.pandorabeadssell.co.uk/ or maybe tumbler plus include not less than 900 styles <a href=http://www.pandorabeadssell.co.uk/>Pandora Jewelry</a> All these beads depict the birthstones, zodiac signs, family pets, alphabets, letters, along with each one <a href="http://www.pandorabeadssell.co.uk/">Pandora Bracelets</a>having exclusive in addition to challenging design. Most of these extensive choice ensure that there is absolutely no repetition regarding design and style. The particular drops are intended in such a way who's complements active bracelet or perhaps necklace. In case you are going to buy necklace rather than beans on it's own, the gathering may be a lot more personalized in order to allure an individual heart. Your necklace around your neck starting is available in inches wide along with the necklace around your neck length is generally ins. This sizes along with facets could be interchanged so the choice associated with toggle bracelet or perhaps your necklace around your neck and also a new keychain can be different to you personally but it will takes age groups to uncover the redundant these days.
Posted by Meefrownege, 10/02/2012 6:37pm (12 days ago)
-
It's really a great and helpful piece of info.
Posted by ExamsKing, 10/02/2012 2:17pm (12 days ago)
-
Thank you for another essential article. Where else could anyone get that kind of information in such a complete way of writing? I have a presentation incoming week, and I am on the lookout for such information.
Posted by Vincent Marx, 24/01/2012 11:36am (29 days ago)
RSS feed for comments on this page | RSS feed for all comments







