简体   繁体   中英

how to show photos on magento

i would like to show my members uploaded photo on my account of magento but can't get it. My sql query is ok showing the results just fine.

I tried : echo '<img src="members/crazy.jpg" alt="Member Photo" /><br/>'; the directory is ok but still the image is not show.

Is there any different comment to show photos on magento how i will able to do that can anybody tell me with the directory ?

What happens when you try to open the image in a browser? eg http://yoursite.com/members/crazy.jpg ?

If you check your media folder in magento and copy the .htaccess file from there into the members directory it should fix it.

If you don't have the .htaccess file in the folder it uses the .htacces from the main directory which would not allow direct access to these files.

The example path is relative, it does not start with a solidus ( / ). This means a browser will interpret it differently depending on which page it is viewed from. You can probably get around this by making it absolute but the preferred way is to use getUrl which uses the configured store domain and decides between http or https plus many other considerations.

echo sprintf('<img src="%s" alt="Member Photo" />',
    Mage::getUrl('members/crazy.jpg', array('type' => 'direct_link');

Here's the same thing done from a template file:

<img src="<?php
    echo $this->getUrl('members/crazy.jpg', array('type' => 'direct_link')
?>" alt="Member Photo" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM