How to find large images and files in IBM WCM

WebSphere Portal LogoEven though you can limit the maximum size of the resources that can be uploaded in WCM, you may still wish to perform an occasional audit for large files. The FindLargeResources module, developed for APAR PK75187 (going back to Portal 6.1.0.4), was created for such a task.

WHY?

Users can experience poor performance when viewing large resources that have been uploaded into Image, File, and Rich Text Components (including the Ephox EditLive!). You may wish to periodically review large items in an effort to improve user experience. For example, you may have a content author who is uploading unnecessarily high-res images that needs to be identified and educated.

You could use the WCM API to determine the size of images for Image and File Components, but that would be very slow because each item would have to be retrieved individually. Furthermore, there is no API tool to find the size of embedded images in Rich Text fields. So, the FindLargeResources module fills these gaps.

HOW?

The following lines should be added to the WCMConfigService.properties file in <Portal directory>/wcm/shared/app/config/wcmservices

connect.businesslogic.module.findlargeresources.class=com.ibm.workplace.wcm.services.statistics.FindLargeResourcesModule
connect.businesslogic.module.findlargeresources.remoteaccess=true
connect.businesslogic.module.findlargeresources.autoload=false

Also, append findlargeresources to this key: ‘connect.businesslogic.module’

For example:

connect.businesslogic.module=template,multi_template,web,mail,form,aggregator,default,ajpe,federatedproxy,ajpecatselect,memberfixer,versioningenablement,workflowenablement,itemdispatcher,plutouploadfile,plutodownloadfile,ensureusermanagement,pdmproxy,synd,subs,syndication,refreshallitems,unlocklibrary,findlargeresources,custom

Restart the server for the changes to take effect. You should then be able to execute the module by entering a URL in your browser, similar to the following:

http://<serverName>:/wps/wcm/connect?MOD=FindLargeResources[&min_size=]

The module will find all Image File and Rich Text Component’s resources that are greater than the minimum size specified by the “min_size” parameter (in bytes). If no size is specified, it will look by default for resources greater then 1 Mb. For Rich Text Components, it will not find resources that are less than 2 Mbs.

The result will output each resource item’s name, path, type and size.