Images not loading on localhost

Hi Guys,

recently started on rails. Currently trying to get images to load on page but the images are not loading, instead it just shows a white space wherever i slot in images in my html code

Here are some of the code i have entered into my view/pages/home/html file

<div id="SAVEonSHIRTS-website-homepage-01">

	<img src="C:\Sites\sos_images\SAVEonSHIRTS_website_homepage_01.jpg" width="1024" height="816" alt="">

</div>

<div id="SAVEonSHIRTS-website-homepage-02">

	<img src="C:\Sites\sos_images\SAVEonSHIRTS_website_homepage_02.jpg" width="745" height="120" alt="">

</div>

<div id="SAVEonSHIRTS-website-homepage-03">

	<img src="C:\Sites\sos_images\SAVEonSHIRTS_website_homepage_03.jpg" width="87" height="120" alt="">

</div>

<div id="SAVEonSHIRTS-website-homepage-04">

	<img src="C:\Sites\sos_images\Happy_smiley_face" width="77" height="120" alt="">

</div>

but my images are not showing. anyone have any ideas?

Thanks in advance !

You can place the images in the assets\images folder and use image_tag in rails to generate the markup

This is the API Page for image_tag http://apidock.com/rails/ActionView/Helpers/AssetTagHelper/image_tag

Thanks, Ganesh

Hi Ganesh ! Thanks for the reply ! Sorry to be asking such fundamental questions, but how can i place the images in the assets/images folder?

Thanks !

Elton

Sorry its a physical drag to the folder right ?

Yes you just need to move them. The best way to learn Rails from scratch is this beginner tutorial by Michael Hartl. He covers all aspects step by step in a very easy to understand way

http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=4.0

Thank you so much Ganesh ! Just one question I have currently written this to call the image

<div id="SAVEonSHIRTS-website-homepage-01">

	<image_tag("Happy_smiley_face")>

</div>

However it is still not loading, do you happen to know why ?

Thanks again

Elton

Try this with the file extension (e.g. Happy_smiley_face.jpg) Also the file should be in images folder and the casing should match if you are running on Mac/Linux

Hey Ganesh,

Sorry Ive been trying to use your method,

This is the code I have, However the images are still not showing

<div id="SAVEonSHIRTS-website-homepage-01">

	<image_tag("SAVEonSHIRTS_website_homepage_01.png")>

</div>

<div id="SAVEonSHIRTS-website-homepage-02">

	<image_tag("SAVEonSHIRTS_website_homepage_02.png")>

</div>

<div id="SAVEonSHIRTS-website-homepage-03">

	<image_tag("SAVEonSHIRTS_website_homepage_03.png")>

</div>

I have made sure that all the image names are the same already and that they are stored in the images file in the assets file.

Do you have any thoughts ?

Please work through a tutorial on Rails so you have some basic knowledge of how views/ERB work.

Hint: there's a major difference between   "<image_tag " and   "<%= image_tag "

Good luck.