concrete5 provides an asset library helper, which makes it easy to add file support to your own custom forms and blocks. When used, the asset library helper creates a javascript area that is capable of launching the file manager, managing file permissions, etc…

Loading the Helper

$al = Loader::helper(‘concrete/asset_library’);

Methods

$al->file($formElementID, $formName, $chooseText, $fileObject = null)

Creates a concrete5 file element. Gives the element the ID $formElementID, and the form name $formName. This will be the name of the item in the $_REQUEST or $_POST array. (Note: the concrete5 file element does NOT post using $_FILES. It posts numerical file IDs of files already stored within the concrete5 file manager.)

$al->file(‘thumbnail’, ‘thumbnailFileID’, ‘Select Thumbnail’);

When the surrounding form is submitted, check $_POST[‘thumbnailFileID’] for a numerical file ID.

Optionally, a File object can be provided, and the form element will show that as initially selected.

$al->image($formElementID, $formName, $chooseText, $fileObject = null)

Exactly like file(), but restricts selection to image file types.


Recent Discussions on this Topic

5.7... image selector not working?

I made a block where some pictures must be selected. What's the problem? I can add an image and the fID will be saved in my db table. But on editing the block, the value is not set. There only appears a selector for selecting a new image. In 5.6 and old…

How to save asset library image object as a page attribute?

Hi all, So I've been trying to replace a normal form image element with an image loader from the asset library to access some callback functions. so I want to replace this -> [code] echo $akt->render('form', $tvalue, true); [/code] with this …

problem choosing file from asset library

hi guys, im having a problem where my asset library loads but won't let me choose any images or files? Do i need to load some sort of helper to allow the javascript of the asse library to function properly? [code] $al = Loader::helper('concrete/ass…

Problem Choosing Image after Upload

If I upload an image using the "Asset Library" file selector. The image uploads correctly I enter any extra property bits and assign to any sets. I close or click update, and then am taken back to my filemanager. This is a blanket problem across my si…