Codeigniter images does not load

Asked

Viewed 673 times

3

I am new using the IC, and I’m having problems with it because it does not load the images in environment localhost (using XAMPP). I have already inspected and checked if the path is all ok, and this indeed, but nothing from the image load.

I have tested in localhost, but without using the IC and the image loads normally, I would like someone with more knowledge that I help me.

<div id="products">
    <ul>
        <?php foreach ($products as $product): ?>
            <li>
                <?php echo form_open("shop/add"); ?>
                    <div class="name"><?php echo $product->name; ?></div>
                    <div class="thumb">
                        <?php echo img(array(
                            'src' => 'img/'.$product->image,
                            'class' => 'thumb',
                            'alt' => $product->name)); ?>
                    </div>
                    <div class="price">$<?php echo $product->price; ?></div>
                <?php echo form_close(); ?>
            </li>
        <?php endforeach; ?>
    </ul>
</div>

$config['base_url'] = 'http://localhost/carrinho/';
  • you are using a direct helper or img tag? if you have the source code edit the question and add it. The base_url is configured as?

  • The html generated by img() comes as?

  • <img src="http://localhost/cart/img/rubbar.jpg" class="Thumb" alt="Rubbar">

  • has a http:// before localhost

  • utlized helpers - form, html, url

  • Try to change the base_url just for the name of the project, I believe that so it should access the assets/img

  • put $config['base_url'] = 'cart/'; and nothing :/

Show 2 more comments

1 answer

-1

The problem was that the images folder was inside Application, I put a level out and It worked! problem solved.

  • If you have a new question, ask it by clicking the button Ask question. Include a link to this question if it helps provide context. - From Review

  • Problem solved guys!!

  • the problem was that the images folder was inside Application, I put a level outside and WORKED!! those who at least tried to help me thank you and succeed!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.