# Paperclip image styles getting cropped

**URL:** <https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823>\
**Category:** Rails\
**Created:** [July 28, 2009, 4:38pm UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823 "2009-07-28T16:38:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [July 28, 2009, 4:38pm UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823/1 "2009-07-28T16:38:16Z")

</div>

Hello All,

I am using rails paperclip plugin for image upload.  
my image has different styles and the original image gets cropped  
while processing styled image.

I dont want image to be cropped.  
Is there any way ???

Thanks,  
Sandip R~

–  
Ruby on Rails Developer

> **[Blogs - Neuigkeiten - Artikel - Webseiten - Medien](https://www.sosblog.com/)**
>
> Auf SOSblog geht es um aktuelle Blogs, Neuigkeiten, Artikel, Webseiten und Medien. Wir bringen interessante neue Webseiten aus den Tiefen des Webs.

> **[Judul Situs](https://funonrails.wordpress.com)**
>
> “Cinta tidak mengenal batas. Cinta mampu melewati rintangan, melompati pagar, menembus dinding untuk mencapai tujuannya dengan penuh harapan.” — Maya Angelou

> **[Josh Software | Custom Software Development Services & Solutions](https://joshsoftware.com/)**
>
> JoshSoftware offers custom software development Services & Solution that provides enterprise, software development services for web & mobile.

---

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [July 28, 2009, 9:26pm UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823/2 "2009-07-28T21:26:54Z")

</div>

On Tue, Jul 28, 2009 at 4:37 PM, Sandip R.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Thanks,  
> Sandip R~

Paperclip should only adjust the original image if you have a style  
setup for :original  
Perhaps send your has\_attached\_file code if that doesn’t help

Andrew T.  
[http://ramblingsonrails.com](http://ramblingsonrails.com)

[http://MyMvelope.com](http://MyMvelope.com) - The SIMPLE way to manage your savings

---

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [July 29, 2009, 7:55am UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823/3 "2009-07-29T07:55:27Z")

</div>

Hi

here is my attached file code

#Files attached to channels  
has\_attached\_file :logo,  
:styles =\> { :small\_thumb =\> [“64x44#”, :jpg],  
:large\_thumb =\> [“81x81#”, :jpg]},  
:storage =\> :s3,  
:path =\> “:attachment/:id/:style.:extension”,  
:s3\_credentials =\> open( “#{RAILS\_ROOT}/config/s3.yml”, ‘r’ ),  
:s3\_permissions =\> ‘public-read’,  
:bucket =\> ApplicationConfig[‘s3\_buckets’][‘channels’][ ‘logo’  
],  
:default\_url =\> “/images/missing/channels/logo/:style.gif”

Thanks,  
Sandip R~

---

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [July 29, 2009, 7:57am UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823/4 "2009-07-29T07:57:12Z")

</div>

uploading a square image is not a problem.  
but when i upload a rectangular image.  
image gets distorted.

On Wed, Jul 29, 2009 at 11:24 AM, Sandip R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> :path => ":attachment/:id/:style.:extension",
> :s3_credentials => open( "#{RAILS_ROOT}/config/s3.yml", 'r' ),
> :s3_permissions => 'public-read',
> :bucket => ApplicationConfig['s3_buckets']['channels']['logo'],
> :default_url => "/images/missing/channels/logo/:style.gif"
> 
> ```
> 
> Thanks,  
> Sandip R~

–  
Ruby on Rails Developer

> **[Blogs - Neuigkeiten - Artikel - Webseiten - Medien](https://www.sosblog.com/)**
>
> Auf SOSblog geht es um aktuelle Blogs, Neuigkeiten, Artikel, Webseiten und Medien. Wir bringen interessante neue Webseiten aus den Tiefen des Webs.

> **[Judul Situs](https://funonrails.wordpress.com/)**
>
> “Cinta tidak mengenal batas. Cinta mampu melewati rintangan, melompati pagar, menembus dinding untuk mencapai tujuannya dengan penuh harapan.” — Maya Angelou

> **[Josh Software | Custom Software Development Services & Solutions](https://joshsoftware.com/)**
>
> JoshSoftware offers custom software development Services & Solution that provides enterprise, software development services for web & mobile.

---

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [July 29, 2009, 11:43am UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823/5 "2009-07-29T11:43:08Z")

</div>

solved

“#” used in style needs to be removed.

#Files attached to channels  
has\_attached\_file :logo,  
:styles =\> { :small\_thumb =\> [“64x44”, :jpg],  
:large\_thumb =\> [“81x81”, :jpg]},  
:storage =\> :s3,  
:path =\> “:attachment/:id/:style.:extension”,

---

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [July 29, 2009, 10:10am UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823/6 "2009-07-29T10:10:03Z")

</div>

On Wed, Jul 29, 2009 at 7:54 AM, Sandip R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ```
> :storage => :s3,
> :path => ":attachment/:id/:style.:extension",
> :s3_credentials => open( "#{RAILS_ROOT}/config/s3.yml", 'r' ),
> :s3_permissions => 'public-read',
> :bucket => ApplicationConfig['s3_buckets']['channels']['logo'],
> :default_url => "/images/missing/channels/logo/:style.gif"
> 
> ```
> 
> Thanks,  
> Sandip R~

Sandip

Based on this code, both the :small\_thumb and :large\_thumb will be  
cropped but nothing should be happening to the original image at all.

First check you’re using the latest version of Paperclip and then file  
a bug with Paperclip if it persists.

Andrew T.  
[http://ramblingsonrails.com](http://ramblingsonrails.com)

[http://MyMvelope.com](http://MyMvelope.com) - The SIMPLE way to manage your savings

---

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [July 29, 2009, 4:54pm UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823/7 "2009-07-29T16:54:00Z")

</div>

Thanks, Andrew !  
I will make that change

Sandip R~

---

<div class="post-metadata">

**Author:** ![san2821](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/4da419/32.png) [@san2821](https://www.ruby-forum.com/u/san2821)\
**Post date:** [July 29, 2009, 11:55am UTC](https://www.ruby-forum.com/t/paperclip-image-styles-getting-cropped/172823/8 "2009-07-29T11:55:26Z")

</div>

On Wed, Jul 29, 2009 at 11:41 AM, Sandip R.[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> extension",

Sandip

Your resizing will warp (squash or stretch) images if they don’t match  
your dimensions.  
To resize while maintaining aspect ratio, use “64x64\>” - This will  
result in either the width or the height = 64 and the other side will  
be relatively smaller.  
To resize with crop, use “64x64#” - This will result in both width and  
height = 64 and the longer of the two will be cropped evenly on either  
side.

You should usually use one of these unless you are very sure of the  
aspect ratio of the images being uploaded.

Andrew T.  
[http://ramblingsonrails.com](http://ramblingsonrails.com)

[http://MyMvelope.com](http://MyMvelope.com) - The SIMPLE way to manage your savings
