Images not loading on localhost

404 views
Skip to first unread message

Elton Yau

unread,
Apr 4, 2014, 4:06:59 PM4/4/14
to rubyonra...@googlegroups.com
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="Table_01">
<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 !

Ganesh Ranganathan

unread,
Apr 4, 2014, 4:16:11 PM4/4/14
to rubyonra...@googlegroups.com

On Sat, Apr 5, 2014 at 1:36 AM, Elton Yau <yaue...@gmail.com> wrote:
<img src="C:\Sites\sos_images\Happy_smiley_face" width="77" height="120" alt="">

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


Thanks,
Ganesh

Elton Yau

unread,
Apr 4, 2014, 4:37:57 PM4/4/14
to rubyonra...@googlegroups.com
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

Elton Yau

unread,
Apr 4, 2014, 4:41:16 PM4/4/14
to rubyonra...@googlegroups.com
Sorry its a physical drag to the folder right ?

Ganesh Ranganathan

unread,
Apr 4, 2014, 4:47:23 PM4/4/14
to rubyonra...@googlegroups.com

On Sat, Apr 5, 2014 at 2:11 AM, Elton Yau <yaue...@gmail.com> wrote:
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



Elton Yau

unread,
Apr 4, 2014, 4:50:41 PM4/4/14
to rubyonra...@googlegroups.com
Thank you so much Ganesh !  Just one question I have currently written this to call the image

<div id="Table_01">
<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

Ganesh Ranganathan

unread,
Apr 4, 2014, 5:15:59 PM4/4/14
to rubyonra...@googlegroups.com

On Sat, Apr 5, 2014 at 2:20 AM, Elton Yau <yaue...@gmail.com> wrote:
<image_tag("Happy_smiley_face")>

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

Elton Yau

unread,
Apr 4, 2014, 5:54:01 PM4/4/14
to rubyonra...@googlegroups.com
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="Table_01">
<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 ?

Hassan Schroeder

unread,
Apr 4, 2014, 6:02:58 PM4/4/14
to rubyonrails-talk
On Fri, Apr 4, 2014 at 2:54 PM, Elton Yau <yaue...@gmail.com> wrote:

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

> <image_tag("SAVEonSHIRTS_website_homepage_01.png")>

> 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.
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
http://about.me/hassanschroeder
twitter: @hassa
Reply all
Reply to author
Forward
0 new messages