【问题标题】:Magento EE 1.13.0.2: Customer Attribute Input type ImageMagento EE 1.13.0.2:客户属性输入类型图像
【发布时间】:2013-10-04 21:39:06
【问题描述】:

我很高兴能够通过 Enterprise 中的管理员添加自定义客户属性。 与您必须将它们添加到社区中相比,它可以节省大量时间和精力。

我觉得很不错的是输入类型“图像”,它使客户可以上传图像。但是,当客户通过此属性上传图像时,图像会上传到“media/customer”,并且默认情况下该目录具有拒绝任何访问权限的 .htacces。

我手头的问题是我添加了一个名为“头像”的属性,客户可以使用它来上传图像。现在我想在“我的帐户”部分的仪表板上显示此图像,但“媒体/客户”目录中的 .htaccess 文件阻止了我这样做。

我可以删除/调整 .htaccess 文件吗?或者是否有不同的方法来显示存储在“媒体/客户”中的图像?

我正在使用以下方式显示头像:

<?php $_file = 'customer' . $this->getCustomer()->getAvatar() ?>
<?php if(file_exists(Mage::getBaseDir('media') . '/' . $_file)): ?>
<?php $_imgUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA) . $_file ?>
<?php else: ?> <?php $_imgUrl = $this->getSkinUrl('images/default_avatar.gif', array('_secure'=>true)) ?>
<?php endif; ?>
<div class="avatar"> <img src="<?php echo $_imgUrl ?>" height="91" width="91" /> </div>

【问题讨论】:

  • 你是如何显示头像的?
  • 我正在显示头像使用: getCustomer()->getAvatar() ?> getSkinUrl('images/default_avatar.gif', array('_secure'=>true)) ?>
    " height="91" width="91" />
  • 请粘贴.htaccess的内容
  • "命令拒绝,允许全部拒绝" 我知道这就是图像不显示的原因。但我不知道客户目录通常包含哪些需要从所有人中拒绝的内容。

标签: magento magento-1.13


【解决方案1】:

在您的 .htaccess 中,添加第三行:

allow from YOUR_SERVER_IP

【讨论】:

    猜你喜欢
    • 2013-12-23
    • 1970-01-01
    • 2011-12-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多