showing bad quality image on ruby on rails websit
ruby script:
<div align="center">
<p align="center">
<%= if property.images[0] then link_to image_tag
(property.images[0].image.url('700x525', :jpg)),
user_property_image_path(user, :id => property.images[0],
:property_id => property) end -%>
</p>
</div>
hot to improve the photo quality?
The loaded photo is 600x400px, I thought the website was displaying it as 533x354px, but it's not actually scaling it, it's just showing what's (probably) inside your div, and leaves the overflow invisible.
The photos I can see are actually low quality, are those the original ones? (If so, there's not much to do here, unfortunately!)
Related
I'm building a personal website using Ruby with Rails 4.
I'm attempting to scrape Medium.com and have my Medium articles show up on my page. It's almost working, they are displaying on my page how I would want them, but it also displays the entire RSS code underneath my blog posts. I can't figure out how to get this data dump off my view.
What can I do to change this?
Here is my code on the controller:
def blog
require 'rubygems'
require 'rss'
require 'open-uri'
#rss = RSS::Parser.parse('https://medium.com/feed/#AlextheYounger/')
end
Here is the code on my HTML view:
<%= #rss.items.each do |item|%>
<div class="row">
<div id="article-div" class="col-xs-8">
<div class= "well well-lg">
<div class= "article-title">
<p><%="#{item.title}"%></p>
</div>
</div>
</div>
</div>
<% end %>
Again, it actually does display my blog posts, it just does so with a massive data dump included. How do I get rid of this massive data dump?
The issue is that <%= differs from <%
The equals sign tells rails "spit out the result of the current ruby statement onto the screen into your html"... in this case, you are spitting out the result of the ruby-code: #rss.items.each... which happens to return the value of #rss.items (which is all of your rss feed).
For ruby-statements that don't need to output to the screen (like this), just change to using the non-equals-sign version: <% and you should be good to go.
Ok so I've encountered a very very weird problem that has got me staying up late but I finally figured out whats wrong however, the solution is not ideal and I would like to know what is happening. Better yet, how to fix it.
I have a page seperated with many div tags with the id class. I have other pages that are done the same way with no problems at all when I try to link to a particular section of a page from another page with the following methods. However, the problem occurs when the page Im linking to has not enough content.. but still is at least scrollable length.. When clicking on the links that way, instead of moving to the desired section, it just moves towards the bottom.
For instance if you clicked on this website, http://aquaticshelp.com/aquascape/getting-started#aquascape-main-plants and clicked on the "Preparing your plant section" you will see what I mean. This is a very undesirable behavior and Im not sure where to go from here.
<%= link_to 'Section 1', route_path(anchor: "section-1"), class: "h4" %>
<div id="section-1">
</div>
<div id="section-2">
</div>
<div id="section-3">
</div>
EDIT: Added some screen shots for clarity of question
Below is where you click and contains the following code
<%= link_to aquascape_plants_prep_path(anchor: "aquascape-plants-prep-intro") do %>
<%= image_tag("aquascaping/start/plant_prep_img.jpg", size:"140x140", class: "img-circle center-block")%>
<%= link_to 'Preparing the Plants', aquascape_plants_prep_path(anchor: "aquascape-plants-prep-intro"), class: "h4" %>
<% end %>
The following is where it directs me to regardless of the anchor tag
Where I want it to go, and it does if I click on the following
<%= link_to 'Intro', "#aquascape-plants-prep-intro" %>
I'm new to RoR so bear with me.
I have this forthcoming website open in Production Mode here:
http://88.112.168.70/
I have there 2 FB logo pics at the end of every sub-page (the GREEN area) and I honestly have no idea on how to insert URL LINKS on those logos.
The FB logos and the whole ending section currently comes from a LAYOUT file, of whichs' code is below:
<tr>
<td class="otsikko-ala">
<p class="small">
<%=image_tag("facebook_logo-green.png", alt: "Tommi Tiihonen", :class=> "fb", :align=> "right")%>
<%=image_tag("facebook_logo.png", alt: "Tommi Tiihonen", :class=> "fb", :align=> "right")%>
<strong>Web-Studio</strong>
<br>
The World at Your Fingertips
</p>
</td>
So if I would like to have an URL on both images to, say, URL: http://www.com, then how would I do that? I ALSO don't want any borders on the URLed FB logos. BUT I do want to have a Title Tag and an Alt Tag on those.
AND:::: I want to have the TARGET frame value as "_new".
Please if it isn't too much asked, could you put the whole tag here - not only the explanation.
Thanks in advance!
-Tommi
If you want to make a link out of an image, just do this:
<%= link_to 'http://www.com', target: "_blank", alt: "my alt here", title: "my title here" do
<%= image_tag 'facebook_logo.png' %>
<% end %>
Rails noob here. I'm attempting to create create single-page scrolling site similar to this ...but, you know, not nearly as attractive :-)
Anyway, I've got my javascript working however I've developed much of the content (contact form, about us page etc etc) in different views which are hanging out in various html.erb files. Rather than cut and paste the contents of each into a single home.html.erb, I was wondering if there was a clean way to just embed the content from each view into my homepage view. Something like this:
<h1>My awesome homepage!</h1>
<div>
<div id="about">
<%= put_page_here page=about_us %>
</div>
<div id="our_product">
<%= put_page_here page=about_us %>
</div>
<div id="contact">
<%= put_page_here page=contact %>
</div>
</div>
If you would recommend going about this entirely differently, please let me know.
Many thanks in advance!
This should work:
<%= render partial:"shared/contact_us", locals:{variable:value} %>
Note that it will look for a view in app/views/shared/_contact_us.html.erb - notice the _ before the view. Pass the variables the view needs in through locals. More information on passing variables around here.
Rails 2.3.5 (Running in Development Mode on localhost)
I haven't been able to find an answer for this. In IE8 and FF, the alts (tooltips) do not appear on mouseover. Yet for some reason in IE7 they do. I'd guess this is some basic knowledge I'm missing or there's something in my stylesheets that's killing the tooltips in IE7/IE8? I'm not using a tooltip script or plugin.
The two main ways I'm using image_tags:
<%= image_tag("show_group.png", :size => "64x64", :alt => "Show Group") %>
<%=link_to image_tag ("menu_icon_make_new_item.png", :size => "38x27", :alt =>
"Make new item", :id => 'item_select_menu', :class => 'nothing2'), {},
:onclick =>'dialog_back_to_new_item_select_menu(); return false' %>
Although I'm pretty sure it's not a Rails thing because even this hand coded img tag doesn't show it's alt on hover in IE8/FF (but does show it in IE7).
<span id="show_user_panel_arrow"><img src="\images\user_panel_expand.png"
alt="show bulk user panel" id="user_panel_arrow" /></span>
Thanks!
alt is the wrong attribute for tooltips. Old versions of IE improperly used the alt attribute for mouseover titles. alt is the alternative text that gets displayed if the image does not come up.
Use the title attribute.
example:
<img src="mypic.jpg" alt="Description" title="This shows up on mouseover" />
Use title option to display text in rails 3.
<%= image_tag 'show_group.png',:title => 'show_group' %>
When mouse hover over the show_group.png , it will show the text "show_group".
This "feature" was removed in IE8 and other browsers never had it. The alt attribute is for text to display instead of the image and wasn't intended as additional information. That is what the title attribute is for.