Welcome Guest, Not a member yet? Register   Sign In
Where to place assets
#1

[eluser]nZac[/eluser]
Hey all,

Ok I have been messing around with CI for the past 3 or 4 hours at work (I love my job, I mess around with new technologies and see how our company can use them Smile ) and I can't figure out where to put images. I did some search's here on the forum and on the Doc's section and couldn't really find much. The one topic I did find here does not really help me. I put the image folder in the root of my server right next to the index.php file and this is what I do to call it.

Code:
//This is in the blogview.php folder in the /system/application/views/ folder.
<img src="images/dogs.jpg">

//I also tried:
<img src="&lt;?php echo base_url(); ?&gt;images/dogs.jpg">

The image does not show up, it comes out as broken. How do I get that image to show. I am assuming it is a .htaccess problem. I have no .htaccess file as of right now, because I have never really messed with them before.
#2

[eluser]Dam1an[/eluser]
I'm assuming you've done the obvuious thing of setting your base path in the config file? Tongue

Try using the img function in th HTML helper, see if that works

And what paths do you get in the rendered page for the image, is that valid?
#3

[eluser]nZac[/eluser]
To: Dam1an : Yes I did set the base_url in the config file.

This code did not work:

Code:
&lt;? echo img('images/dogs.jpg'); ?&gt;

When I check the rendered source, it checks out as what I would want it to:

http://mydomain.com/images/dogs.jpg
#4

[eluser]Dam1an[/eluser]
can you view the image in the browser via the URL?
It shouldn't be a htaccess issue as you don't have that, so I'm confussed
#5

[eluser]nZac[/eluser]
When I type http://mydomain.com/images/dogs.jpg it outputs http://mydomain.com/images/dogs.jpg
#6

[eluser]n0xie[/eluser]
In your view, does this work?
Code:
<img src="http://mydomain.com/images/dogs.jpg " />
#7

[eluser]nZac[/eluser]
No. I don't exactly understand what is going on right now!
#8

[eluser]n0xie[/eluser]
Me neither. I guess you broke the internet.

What does Firebug 'net' tab say? What does it try to load when it's making a request for the image file?
#9

[eluser]nZac[/eluser]
Wow I feel like an idiot!

Ok when I put the image on the site, I used a different FTP client then what I normally do. So i did not know that I had to do this 'other' step with this new client for the image to go. Instead the FTP made a refrence of some sort on the site, but without actually uploading the image. When the browser goes to look for it, it wont find it because there is no img there. I switched over to the old ftp, uploaded and now it works great.

Thanks for all your help!

Ohh and how do I mark this solved?
#10

[eluser]Dam1an[/eluser]
Edit: irrelevant now that you fixed it
I knew it would have to be something wierd like that, cause otherwise it just didn;t make sense




Theme © iAndrew 2016 - Forum software by © MyBB