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

  • Home
  • SEARCH
  • 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 6602487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:52:58+00:00 2026-05-25T18:52:58+00:00

I have a photo attachment which I’m saving using Paperclip. However, I’d like to

  • 0

I have a photo attachment which I’m saving using Paperclip. However, I’d like to process the photo first before saving by cropping it down and then resizing to the final size:
e.g. I have a 900×900 photo, I want to first do a central crop to 500×500, and then resize the cropped photo down to a thumbnail size of 100×100.

The purpose of this is so that the thumbnail image wouldn’t simply be a scaled down version of the 900×900 since it might be too small to even make out anything in the photo. By cropping it, we reduce a huge part of photo that can be left out and still have a meaningful scaled down thumbnail.

I know paperclip can do either crop or resize, but is there a way to combine both?

Edit: To clarify, I’m not trying to create a cropper tool where the user can interact and crop the image. For every photo that is uploaded, I want to uniformly perform a crop followed by a resize.

Thanks

  • 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-05-25T18:52:58+00:00Added an answer on May 25, 2026 at 6:52 pm

    There’s probably a better way of doing this, but if you’re using ImageMagick this way works fine.

    The following will first crop in the center of the image at 500×500, then throw everything else away, then resize that new image back down to 100×100.

    has_attached_file :image,  
      :styles => { :thumb => "" },
      :convert_options => { 
        :thumb => "-gravity Center -crop 500x500+0+0 +repage -resize 100x100^" },
      :default_style => :thumb
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a photo gallery I would like that every time a user does
So we have a photo like this (source: vkontakte.ru ) How to detect that
I have 2 powershell scripts that I execute from c# which I'm using to
i am develop app in Blackberry which have photo functionality. i want to get
Product has_many :assets Asset belongs_to :product Asset has_attached_file :photo using Paperclip (with all your
I have a photo album gallery within my website and would like to allow
I have a class Scene, which has_one Photo, and Photo belongs_to Scene. I want
I am using Paperclip to handle profile photo uploads in my app. They upload
i have photo gallery which loaded to scroll view vertically and i only want
Hey, I have some trouble using the stream_publish method, more exactly with the attachment

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.