/** * @see FileBackend::getLocalCopy() */ function getLocalCopy( array $params ) { list( $srcCont, $srcRel ) = $this->resolveStoragePath( $params['src'] ); if ( $srcRel === null ) { return null; } // Get source file extension $ext = FileBackend::extensionFromPath( $srcRel ); // Create a new temporary file... // TODO: Caution: tempfile should not write a local file. $tmpFile = TempFSFile::factory( wfBaseName( $srcRel ) . '_', $ext ); if ( !$tmpFile ) { return null; } $tmpPath = $tmpFile->getPath(); try { $this->storageClient->getBlob( $srcCont, $srcRel, $tmpPath ); } catch ( Exception $e ) { $tmpFile = null; } return $tmpFile; }
<?php require_once 'Microsoft/WindowsAzure/Storage/Blob.php'; $storageClient = new Microsoft_WindowsAzure_Storage_Blob(); // download del file picture.jpg in to /path/to/picture.jpg $storageClient->getBlob('testcontainer', 'picture.jpg', '/path/to/picture.jpg');