The restricted plugin integrates context aware media data from the Joomla web site into the Joomla core media manager. With the restricted plugin it is possible to force core media fields to show only folders for the logged in user or the selected article/category. Like that it is possible to allow the editors to upload media only in predefined folders without giving them the possibility to work in not allowed folders. What for restrictions are available can be found below.
It allows the admin to select images in articles and any other extension which uses the core media manager. Beside that it is possible to create folders, upload images, rename and delete the data directly from within Joomla in the restricted folder only. It's possible to add unlimited different restricted folders in the plugin.
Please read the Concept of context aware media access docs article where it is explained more deeply how to glue the restricted plugin with the Content plugin.
Adding a restricted folder is rather straightforward. To do so, open the filesystem Restricted plugin in the plugin manager in the back end of your Joomla site. Click on the green "+" button in the plugin edit form. Define a type and a root folder which must exist. Click the "Save" button in the toolbar of the plugin.
When a restricted adapter is created, then the admin can choose between four types of the adapter:
The folder type is the simplest one and just points to an existing folder in the filesystem where the root files should be created in.
This type uses the current logged in user and shows only images of its own folder. Means when the root folder of the adapter points to /images/users and the current logged in user has the ID 333, then the adapter shows only images from the folder /images/users/{hash of 333}. The user has then no possibility to navigate outside of the folder or upload images into another folder.
When an admin user edits a user, then the form shows the path of the edited user and not the current user. Like that can the admin easily upload media data which do belong only to the edited user and not it's own folder.
As default the user folder is an md5 hash of the user ID and the site secret. There is an option to disable hashing and use the real user ID in the adapter. But this should only be used when you are aware that secure information can be revealed.
This type makes only sense when items like articles are edited. It takes the context of the item into account and it's ID. Means when the root folder of the adapter points to /images/items and an article with the ID 89 is edited, then the adapter shows only images from the folder /images/items/com_content.article/{hash of 89}. The user has then no possibility to navigate outside of the folder or upload images into another folder. When the item is not saved yet, then the images will be stored in a temporary folder with the session id and on save replaced with the real id. Is an item copied, then the media data will be copied to a new folder with the new id and the files will point to the new folder.
As default the item folder is an md5 hash of the item ID and the site secret. There is an option to disable hashing and use the real item ID in the adapter. But this should only be used when you are aware that secure information can be revealed.
The item adapter can be restricted to certain components or categories. Keep in mind that the component and the categories must be selected to limit the adapter to certain categories. If no category is selected it is enabled for all.
This type makes only sense when items like articles are edited. It takes the context and the category ID of the item into account. Means when the root folder of the adapter points to /images/categories and an article with the ID 56 and category ID 13 is edited, then the adapter shows only images from the folder /images/categories/com_content.article/{hash of 13}. The user has then no possibility to navigate outside of the folder or upload images into another folder.
As default the item folder is an md5 hash of the category ID and the site secret. There is an option to disable hashing and use the real category ID in the adapter. But this should only be used when you are aware that secure information can be revealed.
The category adapter can be restricted to certain components.
The restriction types "item" and "category" have a special setting for context substitution. With this setting can the admin define a real world folder name for a given context. Lets make an example, when a substitute is defined for "com_content.article" with the name "blog", then the images are stored in the folder /images/items/blog/{article id} when editing an article and not /images/items/com_content.article/{article id}. Substitutions can be made for every context like com_contact.contact. For context which are not substituted is then the default folder used like /images/items/com_banners.banner/{banner id}.
DPMedia creates a thumbnail out of the original file on the fly while fetching the images list. These thumbnails are only used in the images list for performance reasons to not load tons of high resolution files. In the options the admin can define per account where the thumbnails should be stored on the local filesystem.
DPMedia is fetching only 10 thumbnails per request, otherwise it it can reach the execution time on large folders. So if an image has no local thumbnail a default placeholder will be shown instead.
The plugin supports automatic resize when images are uploaded or the list is created. The admin can choose between the following four options when resizing should be applied:
When only a width or height is set, then a resize is performed and the aspect ratio is kept. Like that will all images have the same width or height. When both dimensions are set, then an option is shown which lets you define if the aspect ratio should be kept or not. If it is not kept, then each image has the same dimensions but the smaller side gets cropped. Here are some examples listed for a better understanding:
Image dimensions | Force width | Force Height | Keep aspect ratio | Resized image dimensions | Crop |
---|---|---|---|---|---|
2000 x 3000 | 0 | 400 | 267 x 400 | No | |
2000 x 3000 | 400 | 0 | 400 x 750 | No | |
2000 x 3000 | 400 | 100 | No | 400 x 100 | Height is cropped from 750 to 100 |
2000 x 3000 | 400 | 100 | Yes | 67 x 100 | No |
2000 x 3000 | 100 | 400 | No | 100 x 400 | Width is cropped from 267 to 100 |
2000 x 3000 | 100 | 400 | Yes | 267 x 400 | No |
Comments (0)