Owen
Owen

Reputation: 361

why is rails image not resizing using "size =>"?

I have a simple static webpage made on rails. Inside the view of the page, I have an embedded ruby code line to display an image called "logos.png". I am trying to display this image stretched horizontally slightly and am trying to do this by increasing the size of the width in pixels, to 2735 x 552 pixels from an original size of 1735 x 552 pixels. Here is my code:

<%= image_tag "logos.png", :size => "2735px × 552" %>

when I use this code the image remains the same size and does not increase its width. I also tried replacing ":size =>" with "size:". how can I increase the width using this or another method? thank you

Upvotes: 0

Views: 267

Answers (1)

Eyeslandic
Eyeslandic

Reputation: 14910

It has to be in the correct format, according to the docs image_tag You're using the multiplication symbol for some reason, the method just uses a simple x as usual.

:size - Supplied as “{Width}x{Height}” or “{Number}”, so “30x45” becomes width=“30” and height=“45”, and “50” becomes width=“50” and height=“50”. :size will be ignored if the value is not in the correct format.

= image_tag "logos.png", size: "2735x552"

Upvotes: 1

Related Questions