Access binary files¶
To access binary files from the PHP API, use the
1 2 3 4 5 6 7 8 9 10 11
Handling binary files¶
Ibexa DXP supports multiple binary file handling mechanisms by means of an
IOHandler interface. This feature is used by the BinaryFile Field Types.
Native IO handler¶
The IO API is organized around two types of handlers, both used by the IOService:
Ibexa\Core\IO\IOMetadataHandler: stores and reads metadata (such as validity or size)
Ibexa\Core\IO\IOBinarydataHandler: stores and reads the actual binary data
You can configure IO handlers using semantic configuration. IO handlers are configurable per SiteAccess. See the default configuration:
1 2 3 4 5 6
The adapter is the driver used by Flysystem to read/write files. Adapters are declared using
Metadata and binary data handlers are configured under
ibexa_io. See below the configuration for the default handlers. It declares a metadata handler and a binary data handler, both labeled
default. Both handlers are of type
flysystem, and use the same Flysystem adapter, labeled
default as well.
1 2 3 4 5 6 7 8 9
nfs_adapter's directory is based on your site settings, and is automatically set to
$var_dir$/$storage_dir$ (for example,
Permissions of generated files¶
1 2 3 4 5 6 7
directories are optional.
- 0644 for files
- 0755 for directories
Make sure to configure permissions using a number and not a string. "0644" is not interpreted by PHP as an octal number, and unexpected permissions can be applied.
As SiteAccess configuration Flysystem's native Local NFS adapter is not supported, the following configuration should be used:
1 2 3 4 5
Native Flysystem handler¶
Ibexa DXP uses it as the default way to read and write content in form of binary files. Flysystem can use the
local filesystem, but is also able to read/write to
zip or cloud filesystems (
league/flysystem (along with FlysystemBundle) is an abstract file handling library.
To be able to rely on dynamic SiteAccess-aware paths, you need to use Ibexa custom
nfs_adapter. A basic configuration might look like the following:
1 2 3 4 5
To learn how to configure other adapters, see the bundle's online documentation.
Only the adapters are used here, not the filesystem configuration described in this documentation.
DFS Cluster handler¶
For clustering, the platform provides a custom metadata handler that stores metadata about your assets in the database. This is faster than accessing the remote NFS or S3 instance to read metadata. For further reading on setting this up, see Clustering.
Enabling BinaryFile Field indexing¶
The indexing of all BinaryFile Fields is disabled by default.
To enable it, first, make sure you have installed Oracle Java/Open JDK 8 or higher and Apache Tika 1.20.
Next, in the
config/packages folder create a
binary_files.yaml file with the following configuration:
1 2 3
To check what types are indexed, check the
ibexa.commerce.site_access.config.search.default.index_content service container parameter. You can override this parameter for a specific SiteAccess by replacing
default by its name
The following file types are indexed by default:
The default path to the Tika jar is specified with the
apache_tika_path parameter in