Caution: The documentation you are viewing is
for an older version of Zend Framework.
You can find the documentation of the current version at docs.zendframework.com
Zend_Service_WindowsAzure_Storage_Blob - Zend_Service
Blob Storage stores sets of binary data. Blob storage offers the following three resources: the storage account, containers, and blobs. Within your storage account, containers provide a way to organize sets of blobs within your storage account.
Blob Storage is offered by Windows Azure as a REST API which is wrapped by the Zend_Service_WindowsAzure_Storage_Blob class in order to provide a native PHP interface to the storage account.
This topic lists some examples of using the Zend_Service_WindowsAzure_Storage_Blob class. Other features are available in the download package, as well as a detailed API documentation of those features.
Using the following code, a blob storage container can be created on development storage.
Example #1 Creating a storage container
Using the following code, a blob storage container can be removed from development storage.
Example #2 Deleting a storage container
Using the following code, a blob can be uploaded to a blob storage container on development storage. Note that the container has already been created before.
Example #3 Storing a blob
Using the following code, a blob can be copied from inside the storage account. The advantage of using this method is that the copy operation occurs in the Azure cloud and does not involve downloading the blob. Note that the container has already been created before.
Example #4 Copying a blob
Using the following code, a blob can be downloaded from a blob storage container on development storage. Note that the container has already been created before and a blob has been uploaded.
Example #5 Downloading a blob
By default, blob storage containers on Windows Azure are protected from public viewing. If any user on the Internet should have access to a blob container, its ACL can be set to public. Note that this applies to a complete container and not to a single blob!
Using the following code, blob storage container ACL can be set on development storage. Note that the container has already been created before.
Example #6 Making a blob publicly available
Windows Azure Blob Storage provides support to work with a "root container". This means that a blob can be stored in the root of your storage account, i.e. http://myaccount.blob.core.windows.net/somefile.txt.
In order to work with the root container, it should first be created using the createContainer() method, naming the container $root. All other operations on the root container should be issued with the container name set to $root.
The Windows Azure SDK for PHP provides support for registering a blob storage client as a PHP file stream wrapper. The blob storage stream wrapper provides support for using regular file operations on Windows Azure Blob Storage. For example, one can open a file from Windows Azure Blob Storage with the fopen() function:
Example #7 Example usage of blob storage stream wrapper
In order to do this, the Windows Azure SDK for PHP blob storage client must be registered as a stream wrapper. This can be done by calling the registerStreamWrapper() method:
Example #8 Registering the blob storage stream wrapper
To unregister the stream wrapper, the unregisterStreamWrapper() method can be used.