Magento Enterprise前端上传图片问题

时间:2016-03-17 13:11:29

标签: php ajax magento

我使用Magento Enterprise ver。 1.13.1.0,我有一个自定义扩展上传图片,这个图片是用于客户头像的,问题是我按下保存按钮后这个图片没有上传到媒体文件夹中。在萤火虫中我有这样的错误:

recs f.2 - fix responsive

Loading LPS_LSH version 1.8.8 (Toolbox v2.3) with debug mode - Revision: 1.3

no subscriber data found in storage

recs 1.1

"NetworkError: 404 Not Found - https://www.domain.com/media/pix_resized/customer/l/o/70x70logo653926.png"

图像是这样的:

 <img class="small-image-preview v-middle" width="70" height="70" src="<?php echo Mage::helper('pixcore/image')->resizeImg($this->helper('pixseller')->getStorePhotoUrl(true), 70, 70, 'customer') ?>" title="View Full Size" alt="View Full Size">

2 个答案:

答案 0 :(得分:1)

现在我可以看到您的图片没有上传或创建拇指有问题。请按照下面的代码我如何做拇指。然后将它与img source一起使用。

$mediaurl= Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
                                    $imageResized = Mage::getBaseDir('media')."/latestnews/resized_".$news->getData('thumbnail');


                                    $imageObj = new Varien_Image(Mage::getBaseDir('media').'/'.$news->getData('thumbnail'));
                                    $imageObj->constrainOnly(TRUE);
                                    $imageObj->keepAspectRatio(FALSE);
                                    $imageObj->keepFrame(FALSE);
                                    $imageObj->resize(177,138);
                                    $imageObj->save($imageResized);
<img src="<?php echo $mediaurl.'latestnews/resized_'.$news->getData('thumbnail');?>" class="post-image img-responsive" title="<?php echo $news->getData("content_heading")?>" alt=""/>

答案 1 :(得分:0)

请使用媒体网址然后路径。 法师:: getBaseUrl(Mage_Core_Model_Store :: URL_TYPE_MEDIA); 谢谢。

相关问题