Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7890723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:25:49+00:00 2026-06-03T06:25:49+00:00

How do I resize an existing image to, say 260×180? I am using Carrierwave

  • 0

How do I resize an existing image to, say “260×180?”

I am using Carrierwave and Rmagick currently to upload images to my Amazon S3 storage bucket, and it creates 2 versions of the image: the original, and the thumb version( 70×70).

Now, I know that I can create another version so that three versions would be created, including the 260×180, but I felt like that was over-clogging the storage database, and I was wondering if I could do it on a view level.

I tried

<%= image_tag(@syllabus.image_url, :size => "260x180") %> 

but it seems like it’s not working – the images are not identical sizes.

Also, if the image is smaller than my desired output, do I need to do something different than to images that are bigger? For example, do I need to cut the bigger ones, but expand the smaller ones, or will it automatically scale to the desired size?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T06:25:50+00:00Added an answer on June 3, 2026 at 6:25 am

    Like @Yosep said, there’s nothing magical of rails going on here. <%= image_tag %> generates an <img> tag in the result html. if you pass a :size => '260x180', the result <img> tag will have its width and height set to 260 and 180.

    Here comes the answer for your question. the best way of providing another image size, is the way you turned down at the beginning. You need to resize those images in the backend and store them somewhere.

    Resizing image by setting the width and height of <img> tag will not keep the image’s original aspect ratio. if the original ratio is 260:180, then it’s fine. But if not, the result will be ugly. Besides, there’s another drawback of doing so, which is the same reason that you should not resize image using CSS also. Resizing large images into smaller ones at client side will eventually be a huge waste of your network, and doing so will slow your site’s rendering. That’s one of YSlow’s rules.

    To resize image using CSS, you can use max-width and max-height, larger images will be resized accordingly, smaller ones will not be resized.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using paperclip to upload and auto-resize photos in my Rails app, and
I have an existing image map in a responsive html layout. Images scale according
Everyone. I am using an image resizer script that resizes JPG images. It worked
How would I resize a image in jQuery to a consistent aspect ratio. For
I'm trying to resize an image in Silverlight 3 that has been submitted by
Excel Interop is removing images from processed files. I’m using the Excel Interop, no
I'm recoding an existing project by using the CakePHP framework. Now, in my existing
Our shop currently uses Quartz for our existing projects. The only draw back is
What are the benefits of using an existing layout manager as opposed writing a
I resize a bitmap using the following code: FileOutputStream out = new FileOutputStream("/sdcard/mods.png"); Bitmap

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.