【问题标题】:Drupal module Azure Blob broken imagesDrupal 模块 Azure Blob 损坏的图像
【发布时间】:2014-12-21 01:08:10
【问题描述】:
我刚开始使用 Azure 构建 Drupal 站点。我安装了Azure Blob module,一切正常(本地环境),包括显示图像并将图像上传到存储 blob。但是,在将站点和数据库部署到临时服务器后,所有图像都损坏了。我确保图像存在,因为我在本地工作时上传了它们。我无法找到实际问题所在。
模块有一段时间没有更新,我花了一些时间挖掘模块的代码,但无济于事。我想知道是否有人遇到过类似的问题,也许可以为我指明正确的方向。提前致谢。
【问题讨论】:
标签:
php
drupal-7
drupal-modules
azure-storage
azure-blob-storage
【解决方案1】:
我终于能够弄清楚问题所在。当一切都部署到 Azure 时,我无法显示或上传图像,我不确定究竟是什么问题,我通过一一排除可能的原因,经历了反复试验的过程。这一切都归结为对模块本身进行更改。在文件“azure_blob.streamwrappers.inc”中,转到函数 createStorageClient。您需要在配置中指定一个 BlobEndpoint。
if (!isset(self::$clients[$scheme])) {
// Obtain user configuration from database
$configuration = ctools_export_crud_load('azure_blob', $scheme);
if (isset($configuration)) {
// @todo Use shared access signature to specify a specific blob endpoint
$connection_string = 'DefaultEndpointsProtocol=https;AccountName=' .
$configuration->account . ';AccountKey=' . $configuration->primary_key . ';BlobEndpoint=http://[StorageName].blob.core.windows.net/';
self::$clients[$scheme] =
ServicesBuilder::getInstance()->createBlobService($connection_string);
// Store other configuration properties in client object
self::$clients[$scheme]->blob_container = $configuration->blob_container;
self::$clients[$scheme]->cache_control = $configuration->cache_control;
}
else {
throw new Exception(t('Invalid storage scheme "@stream"', array('@stream' => $scheme)));
}
}
return self::$clients[$scheme];
我希望这对以后遇到同样问题的人有所帮助。两天来我一直在努力寻找解决方案:)