Skip to content
Everett Griffiths edited this page Jul 17, 2014 · 3 revisions

Customization

The Asset Manager includes several System Settings that affect its behavior.

Thumbnail Size

In the front-end, the dimensions of images is controlled via the output filters, but the size of the thumbnails shown in the manager interface is controlled by the the System Settings:

  • assman.thumbnail_width
  • assman.thumbnail_height

Inside the MODX manager, click on "System --> System Settings" and search for the assman.thumbnail_width and assman.thumbnail_height Settings and adjust them to your preference.

Please note that in theory, the Asset Manager will always store the original assets in their full dimensions, but your server (and the MODX manager) may enforce restrictions on the maximum upload size, and your users will not appreciate having to download massively large files, so it's recommended that you groom your uploads a bit and only upload the largest/highest-quality that you actually need. All thumbnails and resized versions of the original are calculated and cached: the original is not modified unless you specifically request that.

Custom Path Location

By default, the Asset Manager will store uploaded assets inside your site's assets/lib/ folder. Many MODX developers don't realize it, but your assets path is configurable. See your site's config.inc.php file: MODX_ASSETS_URL and MODX_ASSETS_PATH.

The assman.library_path defines a sub-directory of the MODX_ASSETS_PATH, by default lib/ (including the trailing slash). If for any reason, you want to store your uploaded assets in some other directory, you can change this setting. If you have already uploaded assets to your site, make sure you also update the folder name after updating this setting!!! Otherwise the Asset Manager will not be able to find your assets!

Custom URLs

On some web server configurations, you may wish to use different URLs to serve up static assets (such as those uploaded with the Asset Manager: images, PDFs, etc.). For example, you may have a lightweight server process running on port 8080, and you want your assets to be served using that port so those requests don't incur the overhead required from PHP. The Asset Manager can be customized to support this use-case.

  1. Set the assman.site_url System Setting to be the modified copy of your assets URL. For example, if your normal MODX_ASSETS_URL resolves to "http://mysite.com/assets/", and you want to force the Asset Manager to use port 8080, then set this to "http://mysite.com:8080/assets/".

  2. Set the assman.url_override setting to "Yes".

If you have assman.url_override set to yes, the URLs to your assets will be pre-pended with your assman.site_url setting and not with the MODX_ASSETS_URL.

NOTE: in the database, the ass_assets table stores only relative paths to the images. Full paths and full URLs are not stored. Instead, the full path or URL is calculated when the asset is requested. This involves prepending the defined System Setting to the value stored in the database. This is done so you can migrate your site and all of its assets without ever having to worry that the URLs to any asset has been hard-coded. The asset URLs are 100% a product of your site's configuration, so all of the assets managed by the Asset Manager can be migrated to different sites or servers as easily as the parent MODX site.

Adding Assets to other types of Pages

The default behavior is to add assets only to MODX pages (not to Symlinks, Static Resources, Weblinks, or any Custom Resource Classes - CRCs). This can be controlled via the assman.class_keys setting. This is a JSON array identifying the unique class_key value for each resource type.

For example, if you want the Assets tab to appear on Weblink pages, you could add "modWebLink" to the JSON array:

["modWebLink","modDocument"]

If you have created your own Custom Resource Classes (CRCs), then you can list their class_key identifier in the same way:

["modDocument","myCRC"]
Clone this wiki locally