Why the image doesn't show up in <img src="">? |
[eluser]EthanSP[/eluser]
My Code in banner.php: <div> <a href="" target="_parent"> <img src="<?= $base ?>images/slmclogo.png" alt="SLMC Logo" border="0" class="logo" /> </a> </div> Which has been called from mainpage.php: <link rel="stylesheet" type="text/css" href="<?= "$base/$standard_css" ?>" /> ... <div id="top"><? $this->load->view('banner'); ?></div> My controller: $data['base'] = $this->config->item('base_url'); $this->load->view('mainpage', $data);
[eluser]Matthew Lanham[/eluser]
Well... Code: <div> There is no <img> tag around this ? try : Code: <div>
[eluser]EthanSP[/eluser]
[quote author="swanweb" date="1211804818"]Well... Code: <div> There is no <img> tag around this ? try : Code: <div> Sorry, I just erased that part. I also used HTML helper with this code but to no avail: <a href="" target="_parent"> <? $image_properties = array( 'src' => '/images/slmclogo.png', // Also, tried $base.'images/slmclogo.png' 'alt' => 'SLMC Logo', 'class' => 'logo', 'border' => '0', 'title' => 'Go back to Home page'); echo img($image_properties); ?> </a>
[eluser]bradym[/eluser]
Have you tried directly visiting the URL to the image to make sure it's working properly? If you're using .htaccess to remove index.php from your urls, it could be that the images folder needs to be excluded from being redirected to index.php. If you post your .htaccess file (or at least the mod_rewrite rules) I can help you with that.
[eluser]EthanSP[/eluser]
[quote author="bradym" date="1211845513"]Have you tried directly visiting the URL to the image to make sure it's working properly?[/quote] Yes, I have. I tried several combo, such as these: http://localhost/bangungot/index.php/ima...mclogo.png http://localhost/bangungot/images/slmclogo.png http://localhost/bangunogt/index.php/wel...mclogo.png None of these showed my slmclogo.png [quote author="bradym" date="1211845513"]If you're using .htaccess to remove index.php from your urls, it could be that the images folder needs to be excluded from being redirected to index.php. If you post your .htaccess file (or at least the mod_rewrite rules) I can help you with that.[/quote] I didn't modify any .htaccess neither did I attempted to as I am just trying to unlearn CI.
[eluser]gtech[/eluser]
where is your image stored in relation to your CI installation (where the index.php and system directory lives)?
[eluser]EthanSP[/eluser]
[quote author="gtech" date="1211872705"]where is your image stored in relation to your CI installation (where the index.php and system directory lives)?[/quote] Sorry, I just moved my images folder to x:/xampp/htdocs/bangungot/images. The index.php is residing with my welcome.php under the bangungot/jong/application/controllers folder. My "base_url" is set to http://localhost/bangungot/. Given this organization, how should I reference my images (e.g., slmclogo.png)?
[eluser]gtech[/eluser]
in which case it should be http://localhost/bangungot/images/slmclogo.png or <?=base_url()?>images/slmclogo.png you said you browsed to http://localhost/bangungot/images/slmclogo.png and it did not show on the browser.. is this still the case? have you check to see the image is not corrupt, try another image in the same location. check the webserver has permissions to read the file.
[eluser]EthanSP[/eluser]
[quote author="gtech" date="1211906161"]in which case it should be http://localhost/bangungot/images/slmclogo.png or <?=base_url()?>images/slmclogo.png you said you browsed to http://localhost/bangungot/images/slmclogo.png and it did not show on the browser.. is this still the case? have you check to see the image is not corrupt, try another image in the same location. check the webserver has permissions to read the file.[/quote] It's alright now. Thank you very much. I appreciate your feedbacks. I hope this case could be of help to others in this community. |
Welcome Guest, Not a member yet? Register Sign In |