skip to Main Content

I am trying to display an image that I manually uploaded using the cPanel File Manager (or Eclipse Import), using the following in a View:

<img src="/app/public/images/logos/DoesNotShow.jpg">

and it does NOT show up. When I take another jpg that already existed:

<img src="/app/public/images/logos/DoesShow.jpg">

it displays perfectly. If I download DoesShow.jpg from the cPanel File Manager, rename it WillThisShow.jpg, and then upload (using cPanel File Manger) WillThisShow.jpg to the same folder, and put the following in the view:

<img src="/app/public/images/logos/WillThisShow.jpg">

it also does NOT display.

I inspected the non-uploaded and the uploaded, and the full correct path was shown for both.

Any ideas?

2

Answers


  1. Make sure you have sent your base url $config['base_url'] = 'http://example.com/' end it with / so you dont have to use it on view. Also make sure you images are outside of the application

    application
    
    app
    
    app > public
    
    system
    
    index.php
    

    config/autoload the url helper.

    Then on the image

    <img src="<?php echo base_url('app/public/images/logos/WillThisShow.jpg');?>"

    Login or Signup to reply.
  2. Use this If your baseUrl not ending with / eg: http://demo.com then

    <img src="<?php echo base_url();?>/app/public/images/logos/DoesNotShow.jpg">
    

    OR

    Change the permission to 0644

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search