简体   繁体   English

PHP Codeigniter->根文件夹中未显示图像

[英]PHP codeigniter-> Images not showing from root folder

I've searched the answer for this issue but it seems that my images won't show on the admin view. 我已经搜索了此问题的答案,但似乎我的图像不会显示在管理员视图中。

i have my images in the root folder of localhost 我的图像在本地主机的根文件夹中

and it shows me this error in the web console. 它向我显示了Web控制台中的此错误。

 GET http://localhost/tarea8/fotos/8.png 404 (Not Found)
 GET http://localhost/tarea8/fotos/9.png 404 (Not Found)

here is my code to fetch the images 这是我的代码来获取图像

<?php
    $imagenes = cargar_imagenes();
    //$route = base_url('fotos');

    foreach($imagenes as $imagen){
      echo "<tr>"?>
      <td><img src="<?php echo base_url('/fotos')?>/<?php echo $imagen->id?>.png" height='50' class="img-thumbnail"></td>
      <?php
      echo
      "<td>{$imagen->id}</td>
      <td>{$imagen->nombre}</td>
      <td>{$imagen->comentario}</td>

      <tr>";
    }
     ?>

where cargar_imagenes is my method to call the database and call my images assigned via id, everything fetches well but for some reason images won't show. 其中cargar_imagenes是我的方法,用于调用数据库并调用通过id分配的图像,一切正常,但由于某些原因图像无法显示。

hope somebody can help. 希望有人可以帮忙。

如果是,则将图像扩展名保存在数据库中,然后在图像代码后删除.png

尝试这个

  <td><img src="<?php echo base_url('fotos/'.$imagen->id); ?>" height='50' class="img-thumbnail"></td>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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